private void btnStartExec_ItemClick(object sender, ItemClickEventArgs e) { try { var taskSel = GridViewUtil.GetFocusedRow <ITSolution.Scheduler.EntidadesBd.TaskIts>(gridViewTasks); ISchedulerControl sc = ITSActivator.OpenConnection <ISchedulerControl>(Consts.FrameworkSchedulerClass); this.cts = new CancellationTokenSource(); sc.Execute(taskSel.IdTask, cts); } catch (Exception ex) { XMessageIts.ExceptionMessageDetails(ex, "Erro ao iniciar a tarefa!"); } }
private void XFrmAddNewTask_FormClosed(object sender, FormClosedEventArgs e) { if (chkExecuteImediate.Checked && this.task != null) { try { ISchedulerControl sc = ITSActivator.OpenConnection <ISchedulerControl>(Consts.FrameworkSchedulerClass); this.cts = new CancellationTokenSource(); sc.Execute(this.task.IdTask, cts); //using (var scdc = new SchedulerControl()) //{ // this.cts = new CancellationTokenSource(); // await scdc.Execute(this.task.IdTask, cts); //} } catch (Exception ex) { XMessageIts.ExceptionMessageDetails(ex, "Erro ao iniciar a tarefa!"); } } }