コード例 #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();
     }
 }
コード例 #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();
            }
        }
コード例 #3
0
ファイル: ascx_FilterWizard.cs プロジェクト: pusp/o2platform
        /*void task_onTaskExecutionCompletion(ITask task, TaskStatus taskStatus)
        {
            if (taskStatus == TaskStatus.Completed_OK && task.resultsObject is O2Assessment)
                importedO2AssessmentFiles.Add((O2Assessment)task.resultsObject);
         
        }*/

        //    addTask_ImportFiles(new List<string>(new[] { fileToImport }), flowLayoutPanel);


        /*private static void addTask_ImportFiles(List<string> filesToImport, Control flowLayoutPanel)
        {
            var newTask = new core.Ascx.CoreControls.ascx_Task(new Task_LoadAssessmentFiles(filesToImport));
            
            flowLayoutPanel.Controls.Add(newTask);
            newTask.startTask();
        }*/

        private static void addTaskToControlAndStartIt(ITask task, Control targetControl)
        {
            if (targetControl.InvokeRequired)
                targetControl.Invoke(new EventHandler(delegate { addTaskToControlAndStartIt(task, targetControl); }));
            else
            {
                var taskControl = new ascx_Task(new TaskThread(task));
                targetControl.Controls.Add(taskControl);
                taskControl.startTask();
            }
        }