Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: hi friends Pin
Henry Minute2-Jul-09 6:40
Henry Minute2-Jul-09 6:40 
JokeRe: hi friends Pin
musefan2-Jul-09 6:48
musefan2-Jul-09 6:48 
QuestionC# threads and invoking Pin
Blue3652-Jul-09 6:15
Blue3652-Jul-09 6:15 
AnswerRe: C# threads and invoking Pin
Henry Minute2-Jul-09 6:44
Henry Minute2-Jul-09 6:44 
GeneralRe: C# threads and invoking Pin
Luc Pattyn2-Jul-09 6:50
sitebuilderLuc Pattyn2-Jul-09 6:50 
GeneralRe: C# threads and invoking Pin
Henry Minute2-Jul-09 6:56
Henry Minute2-Jul-09 6:56 
AnswerRe: C# threads and invoking Pin
Luc Pattyn2-Jul-09 6:49
sitebuilderLuc Pattyn2-Jul-09 6:49 
GeneralRe: C# threads and invoking Pin
Blue3652-Jul-09 12:22
Blue3652-Jul-09 12:22 
Luc Pattyn wrote:

You can hide it in a helper class, that is what Avoiding InvokeRequired[^] (a very recent article here on CP) does for you, however I'd rather use code that works straight with InvokeRequired.



Hmm I see what you mean (i sorta missed what you said when i first read your post). I read this article and have spent the last couple of hours playing with the demo. It really does just move the problem. May be better tools for this problem should be added to .NET 4.0 (hell its bloated anyway).

I dont know if its the intense heat (some 30C here in the UK), the fact that I am tired, or the fact that I'm watching family guy marathon on DVD, but ive taken the easy way out.


First in MyClass.cs I have added the following property:

public Form Sender { get; set; }


now when a method is called, just before an event is raised, the sender form is checked for InvokeRequired.

if (Sender.InvokeRequired)
{
    var dataDelegate = new Data(LiveStats_OnData);
    Sender.Invoke(dataDelegate, new object[]{sender,e});
}
else
{
    //raise event
}


the horrible nasty InvokeRequired is now tucked away and abstract so the user never sees it.

Bailed. Please Microsoft, give us a break.


GeneralRe: C# threads and invoking Pin
Luc Pattyn2-Jul-09 12:53
sitebuilderLuc Pattyn2-Jul-09 12:53 
AnswerRe: C# threads and invoking Pin
Alan N2-Jul-09 8:29
Alan N2-Jul-09 8:29 
QuestionGridView and making my site look like this page Pin
mjc2252-Jul-09 6:12
mjc2252-Jul-09 6:12 
AnswerRe: GridView and making my site look like this page Pin
Moim Hossain2-Jul-09 9:30
Moim Hossain2-Jul-09 9:30 
QuestionEnumerate Custom Class Pin
Dowse2-Jul-09 4:40
Dowse2-Jul-09 4:40 
AnswerRe: Enumerate Custom Class Pin
Thomas Weller2-Jul-09 5:36
Thomas Weller2-Jul-09 5:36 
GeneralRe: Enumerate Custom Class Pin
Dowse2-Jul-09 5:45
Dowse2-Jul-09 5:45 
GeneralRe: Enumerate Custom Class Pin
Thomas Weller2-Jul-09 6:07
Thomas Weller2-Jul-09 6:07 
GeneralRe: Enumerate Custom Class Pin
Dowse2-Jul-09 6:10
Dowse2-Jul-09 6:10 
AnswerRe: Enumerate Custom Class Pin
Luc Pattyn2-Jul-09 5:47
sitebuilderLuc Pattyn2-Jul-09 5:47 
AnswerRe: Enumerate Custom Class Pin
Dowse2-Jul-09 6:03
Dowse2-Jul-09 6:03 
AnswerRe: Enumerate Custom Class Pin
Dowse2-Jul-09 7:01
Dowse2-Jul-09 7:01 
AnswerRe: Enumerate Custom Class Pin
DaveyM692-Jul-09 5:58
professionalDaveyM692-Jul-09 5:58 
AnswerRe: Enumerate Custom Class Pin
harold aptroot2-Jul-09 6:44
harold aptroot2-Jul-09 6:44 
QuestionThreading Pin
Wogboiii2-Jul-09 4:23
Wogboiii2-Jul-09 4:23 
AnswerRe: Threading Pin
Luc Pattyn2-Jul-09 4:26
sitebuilderLuc Pattyn2-Jul-09 4:26 
AnswerRe: Threading Pin
led mike2-Jul-09 4:36
led mike2-Jul-09 4:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.