Simple C# event args question -


I am using WPF which has a storyboard class in which is completed Is event.

I use it like this:

  sb.Completed + = AddControlToTaskbar; Private Zero AddControlToTaskbar (Object Sender, EventArgs Args) {// ...}  

How do I pass in my code in EventArgs ? It's always empty, and I need a custom category

thanks mark

You do not pass EventArgs for your code, the method that transmits the incident is a common way of handling that your AddControlToTaskbar method stores in the state Such as:

  sb.completed + = new MyCustomClass (theStateYouNeedToStore) .AddControlToTaskbar;  

Your constructor stores the state.

  class MyCustomClass & lt; T & gt; {Private Tea State; Public MyCustomClass (T-state) {this.state = state; } Public Zero AddControlToTaskbar (Object Sender, EventArgs args) {// What you need to do, you have access to your state through this. }}  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -