c# - how to work timer in background -
i can run timer hanging , when run background need timer run in background. can me how run timer in background. timer code is
btnintraday.enabled = false; btnstartbackfill.enabled = false; btnstop.enabled = true; if (btnintraday.text == "intraday") { timerintraday.interval = 5000; timerintraday.enabled = true; btnintraday.text = "updating.."; } else if (btnintraday.text == "updating..") { timerintraday.enabled = false; btnintraday.text = "intraday"; }
and background code
btnintraday.enabled = false; btnstartbackfill.enabled = false; btnstop.enabled = true; txtinterval.text = ddtimeinterval.value.tostring(); int inter = (int.parse(txtinterval.text)) * multiplyingfactorbackfill; try { bgbackfilldcx.runworkerasync(); } catch (exception ex) { }
can please me how run timer in background. in advance.
you may use backgroundworker.
handle backgroundworker.dowork run timer.
handle backgroundworker.progresschanged handle timing events.
handle backgroundworker.runworkercompleted stop timer.
Comments
Post a Comment