Invoke a function every time that a function is been added to my event
-
I want to call to a function every time that a function is add to my Event. How can i do it? Example for this kind of code:
public delegate void DoItDelegate(int i);
public partial class Form1 : Form
{
public DoItDelegate MyFunction;
public int Count=0;
public Form1()
{
InitializeComponent();
//EveryTime that a function been added to this delegate (MyFunction)
//I want that the counter will be reset to 0 (Counter=0)
//The client can add a function to MyFunction throw DLL COM and not just in my code.
//How can i control it and every time reset to Counter to zero?
RegisterTheNewMethod();
MyFunction += new DoItDelegate(DoItFunction);
MyFunction.Invoke(32);
}public void DoItFunction(int i) { Count++; int j = i; //Do Domthing } //I want to call this function every time that a new Function is added to the Event "MyFunction" public void RegisterTheNewMethod() { Count = 0; //Do other things as well } }
Every time that this kind of command (MyFunction += new DoItDelegate(DoItFunction);)is been called and the function is been added to the Event MyFunction i want to invoke some function (In this example RegisterTheNewMethod()). How can i do it?
-
I want to call to a function every time that a function is add to my Event. How can i do it? Example for this kind of code:
public delegate void DoItDelegate(int i);
public partial class Form1 : Form
{
public DoItDelegate MyFunction;
public int Count=0;
public Form1()
{
InitializeComponent();
//EveryTime that a function been added to this delegate (MyFunction)
//I want that the counter will be reset to 0 (Counter=0)
//The client can add a function to MyFunction throw DLL COM and not just in my code.
//How can i control it and every time reset to Counter to zero?
RegisterTheNewMethod();
MyFunction += new DoItDelegate(DoItFunction);
MyFunction.Invoke(32);
}public void DoItFunction(int i) { Count++; int j = i; //Do Domthing } //I want to call this function every time that a new Function is added to the Event "MyFunction" public void RegisterTheNewMethod() { Count = 0; //Do other things as well } }
Every time that this kind of command (MyFunction += new DoItDelegate(DoItFunction);)is been called and the function is been added to the Event MyFunction i want to invoke some function (In this example RegisterTheNewMethod()). How can i do it?
Did you not read the answers to your earlier post? So why post the same again?
All those who believe in psycho kinesis, raise my hand.
-
I want to call to a function every time that a function is add to my Event. How can i do it? Example for this kind of code:
public delegate void DoItDelegate(int i);
public partial class Form1 : Form
{
public DoItDelegate MyFunction;
public int Count=0;
public Form1()
{
InitializeComponent();
//EveryTime that a function been added to this delegate (MyFunction)
//I want that the counter will be reset to 0 (Counter=0)
//The client can add a function to MyFunction throw DLL COM and not just in my code.
//How can i control it and every time reset to Counter to zero?
RegisterTheNewMethod();
MyFunction += new DoItDelegate(DoItFunction);
MyFunction.Invoke(32);
}public void DoItFunction(int i) { Count++; int j = i; //Do Domthing } //I want to call this function every time that a new Function is added to the Event "MyFunction" public void RegisterTheNewMethod() { Count = 0; //Do other things as well } }
Every time that this kind of command (MyFunction += new DoItDelegate(DoItFunction);)is been called and the function is been added to the Event MyFunction i want to invoke some function (In this example RegisterTheNewMethod()). How can i do it?