Arguments passed to the TaskDialog callback.
예제 #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);
        }
예제 #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;
            }
        }
예제 #3
0
        /// <summary>
        /// The callback from the native Task Dialog. This prepares the friendlier arguments and calls the simplier callback.
        /// </summary>
        /// <param name="hwnd">The window handle of the Task Dialog that is active.</param>
        /// <param name="msg">The notification. A TaskDialogNotification value.</param>
        /// <param name="wparam">Specifies additional noitification information.  The contents of this parameter depends on the value of the msg parameter.</param>
        /// <param name="lparam">Specifies additional noitification information.  The contents of this parameter depends on the value of the msg parameter.</param>
        /// <param name="refData">Specifies the application-defined value given in the call to TaskDialogIndirect.</param>
        /// <returns>A HRESULT. It's not clear in the spec what a failed result will do.</returns>
        private int PrivateCallback( [In] IntPtr hwnd, [In] uint msg, [In] UIntPtr wparam, [In] IntPtr lparam, [In] IntPtr refData )
        {
            TaskDialogCallback callback = this.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, this.callbackData ) ? 1 : 0 );
            }

            return 0; // false;
        }
예제 #4
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;
            }
        }
예제 #5
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 );
        }