Example #1
0
        public Task <TaskDialogResult> ShowAsync()
        {
            var context = SynchronizationContext.Current;

            if (context == null)
            {
                return(Task.FromResult(MethodImpl()));
            }
            else
            {
                var taskCompletionSource = new TaskCompletionSource <TaskDialogResult>();

                context.Post(state =>
                {
                    try
                    {
                        taskCompletionSource.SetResult(MethodImpl());
                    }
                    catch (TaskCanceledException)
                    {
                        taskCompletionSource.SetCanceled();
                    }
                    catch (Exception ex)
                    {
                        taskCompletionSource.SetException(ex);
                    }
                }, null);

                return(taskCompletionSource.Task);
            }

            TaskDialogResult MethodImpl()
            {
                var result = ActiveTaskDialog.Show(this, out int button, out int radioButton, out bool verificationFlagChecked);

                ClickedButton       = null;
                SelectedRadioButton = null;

                if (CurrentPage.clrButtons.TryGetValue(button, out TaskButton clickedButton))
                {
                    ClickedButton = clickedButton;
                }

                if (CurrentPage.clrRadioButtons.TryGetValue(radioButton, out TaskRadioButton selectedRadioButton))
                {
                    SelectedRadioButton = selectedRadioButton;
                }

                VerificationFlagChecked = verificationFlagChecked;

                return(result);
            }
        }
Example #2
0
        public TaskDialogResult DoModal(IntPtr hWnd)
        {
            var result = ActiveTaskDialog.DoModal(this, hWnd, out int button, out int radioButton, out bool verificationFlagChecked);

            ClickedButton       = null;
            SelectedRadioButton = null;

            if (CurrentPage.clrButtons.TryGetValue(button, out TaskButton clickedButton))
            {
                ClickedButton = clickedButton;
            }

            if (CurrentPage.clrRadioButtons.TryGetValue(radioButton, out TaskRadioButton selectedRadioButton))
            {
                SelectedRadioButton = selectedRadioButton;
            }

            VerificationFlagChecked = verificationFlagChecked;

            return(result);
        }
 public TaskDialogExpandButtonEventArgs(ActiveTaskDialog activeTaskDialog, bool expanded)
     : base(activeTaskDialog)
 {
     Expanded = expanded;
 }
Example #4
0
        internal void OnClick(ActiveTaskDialog activeTaskDialog)
        {
            TaskDialogEventArgs eventArgs = new TaskDialogEventArgs(activeTaskDialog);

            Click?.Invoke(this, eventArgs);
        }
 public TaskDialogEventArgs(ActiveTaskDialog activeTaskDialog)
 {
     ActiveTaskDialog = activeTaskDialog;
 }
Example #6
0
 public TaskDialogVerificationEventArgs(ActiveTaskDialog activeTaskDialog, bool checkedValue)
     : base(activeTaskDialog)
 {
     Checked = checkedValue;
 }
Example #7
0
 public TaskButtonClickEventArgs(ActiveTaskDialog activeTaskDialog, bool dialogClose)
     : base(activeTaskDialog)
 {
     CancelDialogClose = dialogClose;
 }
 public TaskDialogTimerEventArgs(ActiveTaskDialog activeTaskDialog, uint tickCount, bool resetTickCount)
     : base(activeTaskDialog)
 {
     TickCount      = tickCount;
     ResetTickCount = resetTickCount;
 }
 public TaskDialogHyperlinkEventArgs(ActiveTaskDialog activeTaskDialog, string href)
     : base(activeTaskDialog)
 {
     Href = href;
 }
Example #10
0
 protected internal virtual void OnNavigated(ActiveTaskDialog activeTaskDialog)
 {
     Navigated?.Invoke(this, new TaskDialogEventArgs(activeTaskDialog));
 }
Example #11
0
 protected internal virtual void OnDialogConstructed(ActiveTaskDialog activeTaskDialog)
 {
     DialogConstructed?.Invoke(this, new TaskDialogEventArgs(activeTaskDialog));
 }