P
Peter Larsen []
Hi,
I have a problem passing an event in a method call.
Please see the following sample:
//This class holds information about listeners (in MyEvent).
public class First
{
public event EventHandler<EventArgs> MyEvent;
}
//This class could be a worker-thread.
public class Second
{
public void Method(First aInstance)
{
Third th = new Third();
th.AMethod(aInstance.MyEvent); //THIS IS where i dont know
what to do !!!!!!!!!
}
}
//This class do some work for the worker-thread and is supposed to notify
the listeners (in MyEvent) about the ongoing work.
public class Third
{
public void AMethod(EventHandler<EventArgs> callback)
{
if (callback != null)
callback(this, new EventArgs());
}
}
My problem is in class Second. How do i pass the event (in th.AMethod()) ??
Thank you in advance.
BR
Peter
I have a problem passing an event in a method call.
Please see the following sample:
//This class holds information about listeners (in MyEvent).
public class First
{
public event EventHandler<EventArgs> MyEvent;
}
//This class could be a worker-thread.
public class Second
{
public void Method(First aInstance)
{
Third th = new Third();
th.AMethod(aInstance.MyEvent); //THIS IS where i dont know
what to do !!!!!!!!!
}
}
//This class do some work for the worker-thread and is supposed to notify
the listeners (in MyEvent) about the ongoing work.
public class Third
{
public void AMethod(EventHandler<EventArgs> callback)
{
if (callback != null)
callback(this, new EventArgs());
}
}
My problem is in class Second. How do i pass the event (in th.AMethod()) ??
Thank you in advance.
BR
Peter