private void BtnAddTrigger_MouseUp(object sender, MouseButtonEventArgs e) { if (editjob == null) { return; } var trigger = new CustomTrigger(); var triggerWindow = new TriggerWindow(trigger, true); triggerWindow.Owner = this; triggerWindow.OnSave = (trg) => { editjob.Triggers.Add(trg); dgTriggers.ItemsSource = null; dgTriggers.ItemsSource = editjob.Triggers; QuartzJsonContext.Instance.Update(editjob); QuartzJsonContext.Instance.Commit(); QuartzJsonContext.Instance.Reload(); }; triggerWindow.ShowDialog(); }
private void BtnEditTrigger_MouseUp(object sender, MouseButtonEventArgs e) { if (editjob == null) { return; } var trigger = ((FrameworkElement)sender).DataContext as ICustomTrigger; var triggerWindow = new TriggerWindow(trigger, false); triggerWindow.Owner = this; triggerWindow.OnSave = (trg) => { var _trg = editjob.Triggers.FirstOrDefault(x => x.Name == trg.Name && x.Group == trg.Group); editjob.Triggers.Remove(_trg); editjob.Triggers.Add(trg); dgTriggers.ItemsSource = null; dgTriggers.ItemsSource = editjob.Triggers; QuartzJsonContext.Instance.Update(editjob); QuartzJsonContext.Instance.Commit(); QuartzJsonContext.Instance.Reload(); }; triggerWindow.ShowDialog(); }