Esempio n. 1
0
        private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            TaskDialogNotificationArgs notificationArgs = new TaskDialogNotificationArgs( );

            notificationArgs.Notification = TaskDialogNotification.HyperlinkClicked;
            notificationArgs.Hyperlink    = (string)e.Link.LinkData;

            this.taskDialog.Callback(null, notificationArgs, null);
        }
Esempio n. 2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            this.timerTickCount += (uint)this.timer.Interval;

            TaskDialogNotificationArgs notificationArgs = new TaskDialogNotificationArgs( );

            notificationArgs.Notification   = TaskDialogNotification.Timer;
            notificationArgs.TimerTickCount = this.timerTickCount;

            if (this.taskDialog.Callback(new ActiveTaskDialog(this.Handle), notificationArgs, null))
            {
                // Reset timer.
                this.timerTickCount = 0;
            }
        }
Esempio n. 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;
        }
Esempio n. 4
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;
        }
Esempio n. 5
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();
                    }
                }
            }
Esempio n. 6
0
        private void timer_Tick( object sender, EventArgs e )
        {
            this.timerTickCount += (uint)this.timer.Interval;

            TaskDialogNotificationArgs notificationArgs = new TaskDialogNotificationArgs ( );
            notificationArgs.Notification = TaskDialogNotification.Timer;
            notificationArgs.TimerTickCount = this.timerTickCount;

            if ( this.taskDialog.Callback ( new ActiveTaskDialog ( this.Handle ), notificationArgs, null ) )
            {
                // Reset timer.
                this.timerTickCount = 0;
            }
        }
Esempio n. 7
0
        private void linkLabel_LinkClicked( object sender, LinkLabelLinkClickedEventArgs e )
        {
            TaskDialogNotificationArgs notificationArgs = new TaskDialogNotificationArgs ( );
            notificationArgs.Notification = TaskDialogNotification.HyperlinkClicked;
            notificationArgs.Hyperlink = (string)e.Link.LinkData;

            this.taskDialog.Callback ( null, notificationArgs, null );
        }