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) { } } }