void bw_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { #if DEBUG #else try { #endif RunHelper rh = (RunHelper)e.Argument; if (rh.OnStart != null) { rh.OnStart(); } else { rh.rundebug(rh.Name + " no OnStart delegate was provided, unable to run."); } if (rh.OnEnd != null) { rh.OnEnd(); } #if DEBUG else { rh.rundebug(rh.Name + " no OnEnd delegate provided, run complete."); } #else } catch (Exception ex) { rundebug("error running runhelper, err: " + ex.Message + ex.StackTrace); } #endif }
public static RunHelper run(VoidDelegate start, VoidDelegate complete, DebugDelegate deb, string name) { debs = deb; RunHelper rh = new RunHelper(); if (rh.isBusy) { debug("must wait until previous job completed. " + name); return rh; } if (start == null) throw new Exception("cannot pass a null start delegate to run helper!"); rh = new RunHelper(start, complete, deb, name); rh.bw.RunWorkerAsync(rh); return rh; }
public static RunHelper run(VoidDelegate start, VoidDelegate complete, DebugDelegate deb, string name) { debs = deb; RunHelper rh = new RunHelper(); if (rh.isBusy) { debug("must wait until previous job completed. " + name); return(rh); } if (start == null) { throw new Exception("cannot pass a null start delegate to run helper!"); } rh = new RunHelper(start, complete, deb, name); rh.bw.RunWorkerAsync(rh); return(rh); }
void Chart_KeyUp(object sender, KeyEventArgs e) { try { if ((e.KeyValue >= (int)Keys.A) && (e.KeyValue <= (int)Keys.Z)) { _newstock += e.KeyCode.ToString(); } if ((_newstock.Length > 0) && (e.KeyValue == (int)Keys.Back)) { _newstock = _newstock.Substring(0, _newstock.Length - 1); } this.Text = chartControl1.Title + " " + _newstock; } catch (Exception) { } if (e.KeyValue == (int)Keys.Enter) { _downloadsym = _newstock.ToString(); _newstock = ""; RunHelper.run(downloadchart, null, debug, "download:" + _downloadsym); } }