/// <summary> /// Executes the task. /// </summary> private void ExecuteTask(object formObject) { ExecutionForm form = formObject as ExecutionForm; if (form != null) { form.Invoke(new WriteOutputDelegate(WriteOutput), "-----------------------------------" + Environment.NewLine); form.Invoke(new WriteOutputDelegate(WriteOutput), "Execution is started at " + DateTime.Now.ToString(dateTimeFormat) + Environment.NewLine); try { SqlExecutor sqlExecutor = new SqlExecutor(form.WriteOutputLine, form.solution.ConnectionSetting, form.runningXml); sqlExecutor.Execute(form.solution.Name); form.Invoke(new Action(SetButtonAsCompleted)); } catch (ThreadAbortException taex) { Thread.ResetAbort(); form.Invoke(new WriteOutputDelegate(WriteOutput), "Execution is aborted."); form.Invoke(new Action(SetButtonAsCompleted)); } catch (Exception ex) { WriteOutput(ex.Message); } finally { form.workThread = null; form.Invoke(new WriteOutputDelegate(WriteOutput), "Execution is ended at " + DateTime.Now.ToString(dateTimeFormat) + Environment.NewLine); form.Invoke(new WriteOutputDelegate(WriteOutput), "-----------------------------------" + Environment.NewLine); } } }
/// <summary> /// Handles the Click event of the btnImport control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnExecution_Click(object sender, EventArgs e) { ExecutionForm form = new ExecutionForm(this, this.GetSelectedVersionXml()); form.ShowDialog(); }
/// <summary> /// Handles the Click event of the btnImport control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnExecution_Click(object sender, EventArgs e) { ExecutionForm form = new ExecutionForm(this, this.GetSelectedVersionXml()); form.ShowDialog(); }