|
-
May 7th, 2006, 10:12 AM
#1
Thread Starter
PowerPoster
Raising events in various places
I almost understand the ways of raising events/delegates. All cool stuff. (using .NET 2.0 here)
Now, since my application will not always have a tcp listener available (user can choose this option), it means that the communication classes wont be instantiated until the user selects that they want to listen to incoming communication.
When the user selects this, classA is instantiated, which instantiates classB, which instantiates classC..... and so on.
However, when a certain action/event happens within my application, I want an event to be raised, this event raised should be responded/notifiable to the communication classes only if they are instantiated, or even better, raise the event and the classes will act upon it if they are instantiated.
the Last class of the communication classes will be the one sending data so the events should be detected there, giving it the data to send.
How can I achieve this? how can I raise an event and let the instantiated classes know about this? as well as this, if the event is raised and the communication classes are not instantiated, thats fine, it should simply just ignore it.
using C# 2.0
thanks!
Last edited by Techno; May 7th, 2006 at 10:17 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|