Пример #1
0
 private void UpdateGeneratorButton(object sender, TaskChangingEventArgs e)
 {
     string title;
     switch (e.Reason) {
         case ChangeReason.NextStep:
             return;
         case ChangeReason.Cancelled:
         case ChangeReason.Completed:
             title = GeneratorIdleText;
             break;
         case ChangeReason.Starting:
             title = GeneratorActiveText;
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
     if (GenerateButton.Dispatcher.CheckAccess()) {
         GenerateButton.Content = title;
     }
     else {
         GenerateButton.Dispatcher.Invoke(DispatcherPriority.DataBind, (Action<string>)(text => GenerateButton.Content = text), title);
     }
 }
Пример #2
0
 private void UpdateCurrentTask(object sender, TaskChangingEventArgs e)
 {
     if (CurrentTask.Dispatcher.CheckAccess()) {
         CurrentTask.Text = e.NewTaskName;
     }
     else {
         CurrentTask.Dispatcher.Invoke(DispatcherPriority.DataBind, (Action<string>)(text => CurrentTask.Text = text), e.NewTaskName);
     }
 }