Invoke of Show Form not working

  • Thread starter Thread starter Davis
  • Start date Start date
D

Davis

Hi, I have a UI tester console app which launches my GUI app
(single form)to be tested on separate thread and sets the various controls
using the ControlInvoker class. I'm using CF 1.0 SP3

I can set the testBox,listBox controls in my app to be tested
and read the values back. I've also managed to call the Button_click
handler.

I'm having a problem with showing the form though as i can see the
controls being updated as that bit of the screen refeshes but the
whole form is not shown. I've tried invoking the Show method
but its not working

as below. Can anyone see anything wrong with the code or approach

controlInvoker.Invoke(new MethodCallInvoker(ShowForm), "Show");

static void ShowForm(object[] arguments)
{
object[] parms = new object[] { null};
Type t = testForm.GetType();
MethodInfo mi = t.GetMethod((string)arguments[0], flags);
mi.Invoke(testForm,parms);
}

testForm is static and is the instacnce of my form which i know is correct
as it works with setting controls and below. I've passed null as parms
because Show
does not take parameters.

Doing the same with button1_click works so why doesn't my Show work??

controlInvoker.Invoke(new MethodCallInvoker(InvokeMethod), "button1_Click");
static void InvokeMethod(object[] arguments)
{
object[] parms = new object[] { null, new EventArgs() };
Type t = testForm.GetType();
MethodInfo mi = t.GetMethod((string)arguments[0], flags);
mi.Invoke(testForm, parms);
}
 
Passing "ShowDialog" gets my form displayed but its not what
i want as it blocks the app which i'm testing, Also passing in
"Close" works so i know my code is ok.

Passing in "Show" seems to do nothing. Also each time control
passes to my GUI app there is a WaitCursor showing, i've used
Application.Run to start this app from my console app. Will the
message pump get setup correctly?
 
Back
Top