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 }