public ascx_Task(ITaskThread _taskThread) { InitializeComponent(); try { taskThread = _taskThread; taskThread.setTaskControl(this); setTaskName(taskThread.getTask().getTaskName()); setConfigVisibleStatus(false); } catch (Exception ex) { DI.log.ex(ex, "in ascx_Task()"); } }
private static void RunThread(Type thread) { Logger log = new Logger(thread.Name); log.Log(String.Format("Creating instance of '{0}'", thread.Name)); try { using (ITaskThread instance = (ITaskThread)Activator.CreateInstance(thread)) { instance.SetLogger(log); log.Log(String.Format("Running: {0}", instance.ActionName)); instance.Run(); log.Log(String.Format("Done: {0}", instance.ActionName)); } } catch (Exception ex) { log.Log(String.Format("Error running '{0}'", thread.Name)); log.LogException(ex); } }