I am using the Composite UI application block with a model view presenter architecture. When I set the reference to the view in my presenter I wire up my Changed events like such:
m_View.SalesSubject.StateCodeChanged += new EventHandler(SalesSubject_StateCodeChanged);
this code is called each time that the dialog is created and displayed. Unfortuantely as stated before the number of times the event is called for a particular SalesSubject (cusotmer) = the number of times that specific SalesSubject has been open. Basically I want to subsribe the the event once. I tried this code:
m_View.SalesSubject.StateCodeChanged -= new EventHandler(SalesSubject_StateCodeChanged);
m_View.SalesSubject.StateCodeChanged += new EventHandler(SalesSubject_StateCodeChanged);
Hoping that it would delete the event subscription if it existed. No dice. I hope this makes senses.