Sunday, 15 July 2012

c# - Asynchronous calling a method -



c# - Asynchronous calling a method -

here old code phone call asyn function:

public class caller { public void calculate(calcparameters calcparameters, string sourceapp) { asynccaller caller = new asynccaller(_username, _password, new token()); caller.calculated += new calculatedhandler(oncalculated); caller.calculate(sourceapp, calcparameters); } protected virtual void oncalculated(object sender, calculatedeventargs e) { if (oncalculatedevent != null) oncalculatedevent(e); } public void calculate(string calcid, webservice.calcparameters calcparams) { calculate(0, calcid, calcparams); } public void calculate(long callid, string calcid, webservice.calcparameters calcparams) { seek { lock(this) { worker wsworker = makecalculateworker(callid, calcid, new oncalculatedhandler(oncalculated), calcparams); thread wsthread = new thread(new threadstart(wsworker.calculate)); wsthread.isbackground = true; wsthread.start(); } } grab (exception ex) { _log.writeerror( assembly.getexecutingassembly().getname().name, this.gettype().name, methodbase.getcurrentmethod().name, _username, ex.message); throw ex; } } }

but need using delegate , begininvoke..

please can help me or give me samples read from.

thanks

here msdn illustration explains how utilize asynchronous delegates.

read through go through step step if programme understand it.

asynchronous delegates programming sample

c# asp.net asynchronous delegates begininvoke

No comments:

Post a Comment