Esempio n. 1
0
 public static void executeTask(ITask task, Control controlToHostTask,
                                TaskEvents.TaskEvent_StatusChanged onTaskStatusChange)
 {
     if (controlToHostTask != null && controlToHostTask.InvokeRequired)
         controlToHostTask.Invoke(new EventHandler(delegate
                                                       {
                                                           executeTask(task, controlToHostTask,
                                                                       onTaskStatusChange);
                                                       }));
     else
     {
         task.onTaskStatusChange += onTaskStatusChange;
         var taskControl = new ascx_Task(new TaskThread(task));
         if (controlToHostTask != null)
             controlToHostTask.Controls.Add(taskControl);
         taskControl.startTask();
     }
 }
Esempio n. 2
0
        public static void executeTask(ITask task, Control controlToHostTask,
                                       TaskEvents.TaskEvent_ResultsObject onTaskExecutionCompletion)
        {
            if (controlToHostTask != null && controlToHostTask.InvokeRequired)
                controlToHostTask.Invoke(new EventHandler(delegate
                                                              {
                                                                  executeTask(task, controlToHostTask,
                                                                              onTaskExecutionCompletion);
                                                              }));
            else
            {
                task.onTaskExecutionCompletion += onTaskExecutionCompletion;

                var taskControl = new ascx_Task(new TaskThread(task));
                if (controlToHostTask != null)
                    controlToHostTask.Controls.Add(taskControl);
                taskControl.startTask();
            }
        }