C# Events handling problem for base and derived classes -


I have this case where I am creating 2 different event handlers in a base class and subscribing to them according to quotes Yes Chart Classes The problem I am having is that the first membership is cured for the first instance, but no lower membership is executed. I've included an example of 2 different handlers, quotes and charts, quotes execute for the first time without any problems, but charts are not triggered when the data is received.

  public intangible class MyBaseClass {protected Virtual Zero RaiseOnQuoteData (string item) {} Protected Virtual Zero RaiseOnChartData {string item} {} zero OnDataReceived (object sender , DataEventArgs e) {if (e.Item == "Statement") RaiseOnQuoteData (e.Item); And if (E. ITEM == "Chart") Raisen Chartadata (E. Items); }}   

Excerpt and Chart Class:

  Public class quote: MyBaseClass {public event eventhandler & lt; DataEventArgs & LT; QuoteRecord & gt; & Gt; OnQuoteData; Protected override zero RaiseOnQuoteData (string item) {OnQuoteData.Raise & LT; DataEventArgs & LT; QuoteRecord & gt; & Gt; (This, new DataEventArgs & lt; quoteRecord & gt; (item)); }} Public Class Chart: Mibesclass {public event eventhandler & lt; DataEventErgags & lt; Charteredord & gt; & Gt; OnChartData; Protected override zero RaiseOnChartData (string item) {OnChartData.Raise & LT; DataEventArgs & LT; ChartRecord & gt; & Gt; (This, new DataEventArgs & lt; chartRecord & gt; (item)); }}   

Subscription:

  public class QuoteSubscription {public static void SubscribetoQuoteData () {quotation Q = new quote (); Q. Onocetadata + = new event handler & lt; Data Event ARGs & lt; QuoteRecord & gt; & Gt; (Q_OnQuoteData); } Static void q_OnQuoteData () {// executed upon fix}} public class ChartSubscription {public static void SubscribetoChartData () {chart C = new chart (); C. Authentication + = new event handler & lt; Data Event Parts & lt; Charteredord & gt; & Gt; (Q_OnChartData); } Fixed zero q_OnChartData () {// is not executed}}   

It has been implemented in ASP.NET 4.0, is there any chance that the derivative of the derived classes after both classes Can the problem be shared by the same base class? Any help pointing to the reason would be greatly appreciated.

What's up in the wake? This should be an extension method, because event handler does not define any such method, so you can put a breakpoint inside and see what's going on. (And you can also put a breakpoints inside RaiseOnChartData .)

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -