public static void Explain(this CancelTask runnable, TextWriter writer)
    {
        writer.WriteLine(@"
- Passing a token to a task does only impact the final state of the task
- Cancellation is a cooperative effort
");
    }
Ejemplo n.º 2
0
        public static async Task AsyncButton(object sender, ButtonTask mainTask, CancelTask cancelTaks, string waitText = WaitText)
        {
            if (sender is Button button)
            {
                if (button.Content is string prevText)
                {
                    if (prevText == waitText)
                    {
                        cancelTaks();
                        return;
                    }
                    button.Content = waitText;
                    await mainTask();

                    button.Content = prevText;
                }
            }
        }
Ejemplo n.º 3
0
 private void Cancel(object sender, RoutedEventArgs e)
 {
     CancelTask?.Invoke(this, e);
     this.DialogResult = false;
 }
Ejemplo n.º 4
0
 public void CancelChildTask(CancelTask msg)
 {
     SendTaskControlMessage(msg);
 }