PC Review


Reply
Thread Tools Rate Thread

Invoke of Show Form not working

 
 
Davis
Guest
Posts: n/a
 
      27th Jun 2006
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);
}


 
Reply With Quote
 
 
 
 
Davis
Guest
Posts: n/a
 
      27th Jun 2006
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?


"Davis" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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);
> }
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to invoke a form to show? Altramagnus Microsoft Dot NET Framework 4 13th May 2005 12:12 PM
How to invoke a form to show? Altramagnus Microsoft Dot NET Framework Forms 4 13th May 2005 12:12 PM
How to invoke a form to show? Altramagnus Microsoft C# .NET 4 13th May 2005 12:12 PM
form.show not working Robert Smith Microsoft Dot NET Framework Forms 1 31st Aug 2003 08:23 AM
Form.Label.Invoke method not working John Altland Microsoft Dot NET 1 4th Aug 2003 09:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 PM.