The active Task Dialog window. Provides several methods for acting on the active TaskDialog. You should not use this object after the TaskDialog Destroy notification callback. Doing so will result in undefined behavior and likely crash.
Наследование: IWin32Window
Пример #1
0
        private int PrivateCallback([In] IntPtr hwnd, [In] uint msg, [In] UIntPtr wparam, [In] IntPtr lparam, [In] IntPtr refData)
        {
            TaskDialogCallback callback = Callback;

            if (callback != null)
            {
                // Prepare arguments for the callback to the user we are insulating from Interop casting sillyness.

                // Future: Consider reusing a single ActiveTaskDialog object and mark it as destroyed on the destry notification.
                ActiveTaskDialog           activeDialog = new ActiveTaskDialog(hwnd);
                TaskDialogNotificationArgs args         = new TaskDialogNotificationArgs();
                args.Notification = (TaskDialogNotification)msg;
                switch (args.Notification)
                {
                case TaskDialogNotification.ButtonClicked:
                case TaskDialogNotification.RadioButtonClicked:
                    args.ButtonId = (int)wparam;
                    break;

                case TaskDialogNotification.HyperlinkClicked:
                    args.Hyperlink = Marshal.PtrToStringUni(lparam);
                    break;

                case TaskDialogNotification.Timer:
                    args.TimerTickCount = (uint)wparam;
                    break;

                case TaskDialogNotification.VerificationClicked:
                    args.VerificationFlagChecked = (wparam != UIntPtr.Zero);
                    break;

                case TaskDialogNotification.ExpandoButtonClicked:
                    args.Expanded = (wparam != UIntPtr.Zero);
                    break;
                }

                return(callback(activeDialog, args, CallbackData) ? 1 : 0);
            }

            return(0); // false;
        }
Пример #2
0
 public NiActiveTaskDialog(NiTaskDialog taskDialog, ActiveTaskDialog active)
 {
     _taskDialog = taskDialog;
     _active = active;
 }
Пример #3
0
        private int PrivateCallback([In] IntPtr hwnd, [In] uint msg, [In] UIntPtr wparam, [In] IntPtr lparam, [In] IntPtr refData)
        {
            TaskDialogCallback callback = Callback;
            if (callback != null)
            {
                // Prepare arguments for the callback to the user we are insulating from Interop casting sillyness.

                // Future: Consider reusing a single ActiveTaskDialog object and mark it as destroyed on the destry notification.
                ActiveTaskDialog activeDialog = new ActiveTaskDialog(hwnd);
                TaskDialogNotificationArgs args = new TaskDialogNotificationArgs();
                args.Notification = (TaskDialogNotification)msg;
                switch (args.Notification)
                {
                    case TaskDialogNotification.ButtonClicked:
                    case TaskDialogNotification.RadioButtonClicked:
                        args.ButtonId = (int)wparam;
                        break;
                    case TaskDialogNotification.HyperlinkClicked:
                        args.Hyperlink = Marshal.PtrToStringUni(lparam);
                        break;
                    case TaskDialogNotification.Timer:
                        args.TimerTickCount = (uint)wparam;
                        break;
                    case TaskDialogNotification.VerificationClicked:
                        args.VerificationFlagChecked = (wparam != UIntPtr.Zero);
                        break;
                    case TaskDialogNotification.ExpandoButtonClicked:
                        args.Expanded = (wparam != UIntPtr.Zero);
                        break;
                }

                return (callback(activeDialog, args, CallbackData) ? 1 : 0);
            }

            return 0; // false;
        }
Пример #4
0
            private bool Callback(ActiveTaskDialog taskDialog, TaskDialogNotificationArgs args, object callbackData)
            {
                using (var niActiveTaskDialog = new NiActiveTaskDialog(this, taskDialog))
                {
                    switch (args.Notification)
                    {
                        case TaskDialogNotification.Created:
                            _connectionPoint.ForAll(p => p.OnCreated(niActiveTaskDialog));
                            return false;

                        case TaskDialogNotification.ButtonClicked:
                            bool close = false;
                            _connectionPoint.ForAll(p => p.OnButtonClick(niActiveTaskDialog, args.ButtonId, ref close));
                            return close;

                        case TaskDialogNotification.HyperlinkClicked:
                            _connectionPoint.ForAll(p => p.OnHyperlinkClicked(niActiveTaskDialog, args.Hyperlink));
                            return false;

                        case TaskDialogNotification.Timer:
                            bool resetTimer = false;
                            _connectionPoint.ForAll(p => p.OnTimer(niActiveTaskDialog, (int)args.TimerTickCount, ref resetTimer));
                            return resetTimer;

                        case TaskDialogNotification.Destroyed:
                            _connectionPoint.ForAll(p => p.OnDestroyed(niActiveTaskDialog));
                            return false;

                        case TaskDialogNotification.RadioButtonClicked:
                            _connectionPoint.ForAll(p => p.OnRadioButtonClicked(niActiveTaskDialog, args.ButtonId));
                            return false;

                        case TaskDialogNotification.DialogConstructed:
                            _connectionPoint.ForAll(p => p.OnDialogConstructed(niActiveTaskDialog));
                            return false;

                        case TaskDialogNotification.VerificationClicked:
                            _connectionPoint.ForAll(p => p.OnVerificationClicked(niActiveTaskDialog, args.VerificationFlagChecked));
                            return false;

                        case TaskDialogNotification.Help:
                            _connectionPoint.ForAll(p => p.OnHelp(niActiveTaskDialog));
                            return false;

                        case TaskDialogNotification.ExpandoButtonClicked:
                            _connectionPoint.ForAll(p => p.OnExpandoButtonClicked(niActiveTaskDialog, args.Expanded));
                            return false;

                        default:
                            throw new InvalidOperationException();
                    }
                }
            }