Пример #1
0
 static void job_OnTaskState(object sender, TaskStateEventArg e)
 {
     if (e.NewState == TaskState.Running)
     {
         running.Set();
     }
 }
Пример #2
0
 /// <summary>
 /// Handler triggered when the task state changed
 /// </summary>
 private void SchedulerJob_OnTaskState(object sender, TaskStateEventArg e)
 {
     if (this.context != null)
     {
         TraceHelper.TraceEvent(this.sessionid, TraceEventType.Information, "[JobMonitorEntry] Task {0}.{1} state changed: {2} -> {3}", e.TaskId.JobTaskId, e.TaskId.InstanceId, e.PreviousState, e.NewState);
         ThreadPool.QueueUserWorkItem(this.CallbackToQueryTaskInfo, false);
     }
 }
Пример #3
0
 void ParentJob_OnTaskState(object sender, TaskStateEventArg e)
 {
     if (e.TaskId.JobTaskId == this.TaskID)
     {
         this.State = e.NewState;
         CancelCommand.RaiseCanExecuteChanged();
         RequeueCommand.RaiseCanExecuteChanged();
     }
 }
Пример #4
0
        private static void OnTaskStateCallback(object sender, TaskStateEventArg args)
        {
            if (TaskState.Finished == args.NewState || TaskState.Failed == args.NewState ||
                TaskState.Canceled == args.NewState)
            {
                try
                {
                    IScheduler    scheduler = (IScheduler)sender;
                    ISchedulerJob job       = scheduler.OpenJob(args.JobId);

                    ISchedulerTask task = job.OpenTask(args.TaskId);
                }
                catch (Exception)
                {
                }
            }
        }
Пример #5
0
        public void taskStateCallback(object src, TaskStateEventArg tsea)
        {
            ConsoleColor c = ConsoleColor.White;

            switch (tsea.NewState)
            {
            case TaskState.Finished:
                c = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Task {0} is finished", tsea.TaskId);
                Console.ForegroundColor = c;
                break;

            case TaskState.Running:
                Console.WriteLine("Task {0} is running", tsea.TaskId);
                break;

            case TaskState.Canceled:
                Console.WriteLine("Task {0} has been cancelled", tsea.TaskId);
                break;

            case TaskState.Dispatching:
                Console.WriteLine("Task {0} has been dispatched", tsea.TaskId);
                break;

            case TaskState.Failed:
                c = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Task {0} has failed", tsea.TaskId);
                Console.ForegroundColor = c;
                break;

            default:
                break;
            }
        }
Пример #6
0
 private static void TaskStateCallback(object sender, TaskStateEventArg e)
 {
 }
Пример #7
0
 void _job_OnTaskState(object sender, TaskStateEventArg e)
 {
     RefreshJobStatus();
 }