Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

thread safe call to button_click

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-22-2006   #1 (permalink)
Bart van der Heijden
Guest


 

thread safe call to button_click

Hi,

I want to make a thread safe call to a button click method.

I am using:

private delegate void BindDelegateLogout(object sender, EventArgs e);
BindDelegateLogout delL;
delL = new BindDelegateLogout(this.btnClickLogout);
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, delL,
this);

But in this Dipatcher.Invoke I need to give 2 arguments, my object and my
EventArge. How do I provide my button click method with these arguments?

I tried:

Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, delL,
null, new Object[] {this, new EventArgs()); but that won't do the trick.

Thanks,

Bart



My System SpecsSystem Spec
Old 03-24-2006   #2 (permalink)
Bart van der Heijden
Guest


 

RE: thread safe call to button_click

"Bart van der Heijden" wrote:

> Hi,
>
> I want to make a thread safe call to a button click method.
>
> I am using:
>
> private delegate void BindDelegateLogout(object sender, EventArgs e);
> BindDelegateLogout delL;
> delL = new BindDelegateLogout(this.btnClickLogout);
> Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, delL,
> this);
>
> But in this Dipatcher.Invoke I need to give 2 arguments, my object and my
> EventArge. How do I provide my button click method with these arguments?
>
> I tried:
>
> Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, delL,
> null, new Object[] {this, new EventArgs()); but that won't do the trick.
>
> Thanks,
>
> Bart
>
>


Solved it:

Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, delL,
this, new Object[] { new EventArgs());

so the argument "arg" should be "this" and the argument "arguments[]" should
be the rest of the arguments, namely "new Object[] {new EventArgs()}
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Start a new thread from an existing thread, which was started from atimer Curious .NET General 1 06-13-2008 01:36 PM
Call function with parameters that also call functions (.Net and P bsdz PowerShell 2 06-10-2008 05:31 AM
Are Activator/Remoting Proxies Thread-Safe? Jules Winfield .NET General 2 04-07-2008 01:23 AM
No replies to my Call of Duty 4 problem thread question... VelociT Gaming 0 12-13-2007 08:46 PM
Is there a thread with Call of Duty 4 issues with Vista x64? VelociT Gaming 0 12-12-2007 02:13 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51