P
Peter
Hi
I call some "worker"-Methods asyncronous. here some simplified code
....
public delegate long AsyncWCaller(string parameter);
....
// Setting the Status-Delegate, worker object is given by parameter
Logger log = new Logger();
worker.StatusEventHandler += new Worker.StatusEvent( log.LogStatus);
// later on - in workerFinishd i will do
// worker.StatusEventHandler -= new
Worker.StatusEvent( log.LogStatus);
// Starting the Job async.
AsyncWCaller asyncW = new
AsyncWCaller(worker.DoSomethingWithNotification);
IAsyncResult wAsyncResult =
asyncW.BeginInvoke( "test", new AsyncCallback(WFinished),
asyncW);
-- ok
----
private void WFinished( IAsyncResult ar )
{
AsyncWCaller caller = (AsyncWCaller) ar.AsyncState;
long result = caller.EndInvoke(ar);
// !!!! My Problem is here
// 1. I will do some logging --> result
// 2.I will remove the status event
// worker.StatusEventHandler -= new
Worker.StatusEvent( log.LogStatus);
//
// so how can i derermine the worker-Object here
}
Thanks Peter
I call some "worker"-Methods asyncronous. here some simplified code
....
public delegate long AsyncWCaller(string parameter);
....
// Setting the Status-Delegate, worker object is given by parameter
Logger log = new Logger();
worker.StatusEventHandler += new Worker.StatusEvent( log.LogStatus);
// later on - in workerFinishd i will do
// worker.StatusEventHandler -= new
Worker.StatusEvent( log.LogStatus);
// Starting the Job async.
AsyncWCaller asyncW = new
AsyncWCaller(worker.DoSomethingWithNotification);
IAsyncResult wAsyncResult =
asyncW.BeginInvoke( "test", new AsyncCallback(WFinished),
asyncW);
-- ok
----
private void WFinished( IAsyncResult ar )
{
AsyncWCaller caller = (AsyncWCaller) ar.AsyncState;
long result = caller.EndInvoke(ar);
// !!!! My Problem is here
// 1. I will do some logging --> result
// 2.I will remove the status event
// worker.StatusEventHandler -= new
Worker.StatusEvent( log.LogStatus);
//
// so how can i derermine the worker-Object here
}
Thanks Peter