public void SetJob(IScheduler scheduler, ITrigger trigger) { this.Update(scheduler); var job = this.Scheduler.GetJobDetail(trigger.JobKey); this.JobName = trigger.JobKey.Name; this.JobGroup = trigger.JobKey.Group; this.JobDesc = job.Description; this.NotifyOfPropertyChange(() => this.JobName); this.NotifyOfPropertyChange(() => this.JobGroup); this.NotifyOfPropertyChange(() => this.JobDesc); this.TriggerName = trigger.Key.Name; this.TriggerGroup = trigger.Key.Group; this.TriggerDesc = trigger.Description; this.TriggerPriority = trigger.Priority; this.NotifyOfPropertyChange(() => this.TriggerName); this.NotifyOfPropertyChange(() => this.TriggerGroup); this.NotifyOfPropertyChange(() => this.TriggerDesc); this.NotifyOfPropertyChange(() => this.TriggerPriority); var ps = job.JobDataMap.Select(m => new Parameter() { Key = m.Key, Value = m.Value != null ? m.Value.ToString() : null }); this.JobTypes = new BindableCollection <Type>(); this.JobTypes.Add(job.JobType); this.JobType = job.JobType; this.NotifyOfPropertyChange(() => this.JobTypes); this.NotifyOfPropertyChange(() => this.JobType); this.MergeParameters(ps, this.jobType); this.ChoicedCalendar = trigger.CalendarName; this.NotifyOfPropertyChange(() => this.ChoicedCalendar); this.ReplaceExists = true; this.NotifyOfPropertyChange(() => this.ReplaceExists); var builder = trigger.GetScheduleBuilder(); var builderType = builder.GetType(); this.ScheduleBuildByVM = this.ScheduleBuildBys.FirstOrDefault(b => b.ApplyTo.Equals(builderType)); this.ScheduleBuildByVM.Restore(builder); this.NotifyOfPropertyChange(() => this.ScheduleBuildByVM); #region 如果改变一个已存在的触发器的 IScheduleBuilder 到不同的类型上, RAMStore 是没有问题的, 如果是用 AdoStore 就会有问题 this.OrgScheduleBuilderType = builderType; #endregion }
public void SetJob(IScheduler scheduler, ITrigger trigger) { this.Update(scheduler); var job = this.Scheduler.GetJobDetail(trigger.JobKey); this.JobName = trigger.JobKey.Name; this.JobGroup = trigger.JobKey.Group; this.JobDesc = job.Description; this.NotifyOfPropertyChange(() => this.JobName); this.NotifyOfPropertyChange(() => this.JobGroup); this.NotifyOfPropertyChange(() => this.JobDesc); this.TriggerName = trigger.Key.Name; this.TriggerGroup = trigger.Key.Group; this.TriggerDesc = trigger.Description; this.TriggerPriority = trigger.Priority; this.NotifyOfPropertyChange(() => this.TriggerName); this.NotifyOfPropertyChange(() => this.TriggerGroup); this.NotifyOfPropertyChange(() => this.TriggerDesc); this.NotifyOfPropertyChange(() => this.TriggerPriority); var ps = job.JobDataMap.Select(m => new Parameter() { Key = m.Key, Value = m.Value != null ? m.Value.ToString() : null }); this.JobTypes = new BindableCollection<Type>(); this.JobTypes.Add(job.JobType); this.JobType = job.JobType; this.NotifyOfPropertyChange(() => this.JobTypes); this.NotifyOfPropertyChange(() => this.JobType); this.MergeParameters(ps, this.jobType); this.ChoicedCalendar = trigger.CalendarName; this.NotifyOfPropertyChange(() => this.ChoicedCalendar); this.ReplaceExists = true; this.NotifyOfPropertyChange(() => this.ReplaceExists); var builder = trigger.GetScheduleBuilder(); var builderType = builder.GetType(); this.ScheduleBuildByVM = this.ScheduleBuildBys.FirstOrDefault(b => b.ApplyTo.Equals(builderType)); this.ScheduleBuildByVM.Restore(builder); this.NotifyOfPropertyChange(() => this.ScheduleBuildByVM); #region 如果改变一个已存在的触发器的 IScheduleBuilder 到不同的类型上, RAMStore 是没有问题的, 如果是用 AdoStore 就会有问题 this.OrgScheduleBuilderType = builderType; #endregion }