PC Review


Reply
Thread Tools Rate Thread

How do I use event in this example

 
 
Tony Johansson
Guest
Posts: n/a
 
      17th Mar 2011
I have these classes
1. MainGUI class -> GameManager class -> Game class -> Player class -> Hand
class
The arrow is the call sequence

In the Hand class I have this code that raise an event when I add a card to
a players hand
public void AddCard(Card card)
{
cards.Add(card);
NotifyPropertyChanged("CardAdded");
}

private void NotifyPropertyChanged(string info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}

Now to my question if I now want MainGUI to be notified when this AddCard
method is called in the Hand class
is that possible ?
The only way I can see is to pass the object reference to this hand class
all the way to the MainGUI class which will be cumbersome.
The actual event object that is stored in the Hand class is defined in this
way
public event PropertyChangedEventHandler PropertyChanged;

//Tony


 
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
Outlook 2007. Event ID 25, Event ID 2000. Microsoft Office 12. Event ID 2001 David F. Sage Microsoft Outlook Discussion 0 10th Mar 2008 01:24 PM
Event ID: 1003, Event Type: Error ,Event Source: System Error,Event Category: (102) BoazBoaz Windows XP General 0 21st Jun 2006 05:39 PM
I need to clear temporary the event sinks from another event and then restore them, but I don't know which methods signed up for that event Serge Shimanovsky Microsoft Dot NET 1 14th Apr 2005 05:37 AM
I need to clear temporary the event sinks from another event and then restore them, but I don't know which methods signed up for that event Serge Shimanovsky Microsoft Dot NET Framework Forms 14 7th Feb 2005 08:48 PM
I need to clear temporary the event sinks from another event and then restore them, but I don't know which methods signed up for that event Serge Shimanovsky Microsoft Dot NET 0 11th Jan 2005 02:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:49 PM.