/// <summary> /// Initializes a new instance of the <see cref="QueueViewModel"/> /// class. /// </summary> /// <param name="tracker">The <see cref="IJobTracker"/> to /// present within the queue.</param> /// <exception cref="ArgumentNullException">tracker is /// null.</exception> public QueueViewModel(IJobTracker tracker) { if (tracker == null) { throw new ArgumentNullException("tracker"); } CancelCommand = new CancelJobCommand(); _tracker = tracker; _tracker.PropertyChanged += _trackerPropertyChanged; _tracker.Pending.CollectionChanged += _pendingChanged; _tracker.Finished.CollectionChanged += _finishedChanged; Entries = new ObservableCollection <JobViewModel>(); IsPresentingQueued = false; CurrentJob = _tracker.Current; if (PostProcessAction == null) { PostProcessAction = new ComboBoxItem(); PostProcessAction.Content = "Nothing"; } }
private void JobStateCallback(object sender, IJobStateEventArg args) { this.State = args.NewState.ToString(); CancelJobCommand.RaiseCanExecuteChanged(); RequeueJobCommand.RaiseCanExecuteChanged(); }