Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: We are inviting you to hotdotnet. Pin
Corinna John11-Feb-04 0:38
Corinna John11-Feb-04 0:38 
GeneralRe: We are inviting you to hotdotnet. Pin
Uwe Keim11-Feb-04 1:43
sitebuilderUwe Keim11-Feb-04 1:43 
GeneralBinding array to combobox Pin
Anonymous10-Feb-04 20:05
Anonymous10-Feb-04 20:05 
QuestionPanel Control covering my other controls... IDE BUG? Pin
gordingin10-Feb-04 16:15
gordingin10-Feb-04 16:15 
AnswerRe: Panel Control covering my other controls... IDE BUG? Pin
Heath Stewart11-Feb-04 3:14
protectorHeath Stewart11-Feb-04 3:14 
GeneralC# communication with events Pin
MusicAlly10-Feb-04 14:45
MusicAlly10-Feb-04 14:45 
GeneralRe: C# communication with events Pin
Kentamanos10-Feb-04 15:35
Kentamanos10-Feb-04 15:35 
GeneralRe: C# communication with events Pin
MusicAlly10-Feb-04 16:54
MusicAlly10-Feb-04 16:54 
Hi David,

Thanks for your feedback. I'll try to give a concise and accurate explanation of what I'm trying to do. When I referred to events in my original post I did mean delegates.

In MFC I wrote a generic subsystem in which there existed the notions of Senders, Receivers, Messages, and the global messaging system (a singleton) which took care of passing on events of interest to appropriate parties (Receivers). Forget about Senders, that was a construct just to facilitate some nuance. So the important things are Receivers and Messages. Receivers are full blown classes which are doing some work within the system. Messages are also classes in their own right, and the nub of the system was that any receiver could register interest in any message, in particular specifying a function on the receiver class itself which would be invoked when that particular message was broadcast by some other object in the system. The whole thing hung together with a load of templated classes, functions etc. This system is a variant of Subject-Observer/Multicast.

Of course in C# we have beautiful constructs (like Java) such as retrieving all the methods for a given type, which makes life much easier because you can invoke a method against a particular object which was much more difficult in C++ for reasons I won't go into here.

Anyway, in C++ the global messaging system singleton executed in its own thread, and when some object wanted to broadcast a message they would obtain a lock on the singleton, call a method to broadcast said message and the singleton would then propagate this message to all interested objects by queueing the message for each thread, the singleton would then use the PostThreadMessage to indicate to the thread that messages were waiting for it, and when the thread received the context and the method referred to through the message map by the parameter to PostThreadMessage was executed, all messages queued up for that thread would then be propagated to the appropriate objects.

So what I was hoping to gain from the delegates/events was that I would be able to fire an event from the singleton to all threads and that an object within each thread would respond to said event and then retrieve all messages queued for objects instantiated within the context of their thread.

Am I going in the right direction do you think? I can supply a code example of what I'm trying if it would make things clearer.

Thanks,

Alastair.
GeneralRe: C# communication with events Pin
Heath Stewart11-Feb-04 3:52
protectorHeath Stewart11-Feb-04 3:52 
GeneralCompiler Optimizations Pin
Andrew Shapira10-Feb-04 13:44
Andrew Shapira10-Feb-04 13:44 
GeneralVS-style colors Pin
Judah Gabriel Himango10-Feb-04 10:30
sponsorJudah Gabriel Himango10-Feb-04 10:30 
GeneralRe: VS-style colors Pin
Heath Stewart10-Feb-04 11:33
protectorHeath Stewart10-Feb-04 11:33 
GeneralRe: VS-style colors Pin
Uwe Keim11-Feb-04 1:47
sitebuilderUwe Keim11-Feb-04 1:47 
GeneralRe: VS-style colors Pin
Judah Gabriel Himango11-Feb-04 4:48
sponsorJudah Gabriel Himango11-Feb-04 4:48 
GeneralRe: VS-style colors Pin
Heath Stewart11-Feb-04 5:12
protectorHeath Stewart11-Feb-04 5:12 
GeneralProgrammatic mouse movement Pin
Darryl Borden10-Feb-04 10:29
Darryl Borden10-Feb-04 10:29 
GeneralRe: Programmatic mouse movement Pin
Judah Gabriel Himango10-Feb-04 10:33
sponsorJudah Gabriel Himango10-Feb-04 10:33 
GeneralDebugging into a reference Pin
gordingin10-Feb-04 10:23
gordingin10-Feb-04 10:23 
GeneralRe: Debugging into a reference Pin
Bill Dean10-Feb-04 10:29
Bill Dean10-Feb-04 10:29 
GeneralRe: Debugging into a reference Pin
gordingin10-Feb-04 10:34
gordingin10-Feb-04 10:34 
GeneralRe: Debugging into a reference Pin
Heath Stewart10-Feb-04 11:35
protectorHeath Stewart10-Feb-04 11:35 
GeneralRe: Debugging into a reference Pin
gordingin11-Feb-04 3:57
gordingin11-Feb-04 3:57 
Generalparallel port Pin
Member 87345210-Feb-04 7:51
Member 87345210-Feb-04 7:51 
GeneralRe: parallel port Pin
Marc Clifton10-Feb-04 8:39
mvaMarc Clifton10-Feb-04 8:39 
GeneralRe: parallel port Pin
Marc Clifton10-Feb-04 9:41
mvaMarc Clifton10-Feb-04 9:41 

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.