Using Event add/remove accessors

"Bhatnagar, Amit" <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
Hi all.

In my program, there is a clear seperation between GUI code and application code - this is implemented by the GUI only being able to "see" an interface class (and specifically implementing the Command and Façade design patterns.)

                                /
                        GUI ->  \ -> AppInterface -> HiddenApp Class(es)
                                /

                         [Command]    [Façade]

An object in the GUI (MyGuiObject) needs to receive an event from an object in the app (HiddenAppObject), but I'd like to hide exactly where the event comes from. So I implemented my own add/remove event accessors on the AppInterface that does event registration/deregistration to the HiddenAppClass:

public class AppInterface
{
  public event EventHandler SomeEvent
  {
    add {HiddenAppClass.TheEvent += value);
    remove {HiddenAppClass.TheEvent -= value);
  }
}

so in the GUI, I only know of the AppInterface, but I am able to receive events from the hidden application classes. 

This works, but I am wondering if anyone knows a reason not to do such a thing? I got this idea from http://msdn.microsoft.com/msdnmag/issues/06/11/NETMatters/default.aspx.

thanks,

The information contained in this e-mail message is PRIVATE. It may contain confidential information and may be legally privileged. It is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any dissemination, distribution or reproduction of this communication is strictly prohibited. If the intended recipient(s) cannot be reached or if a transmission problem has occurred, please notify the sender immediately by return e-mail and destroy all copies of this message. 
Thank you.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.