예제 #1
0
        private IntPtr Callback(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, IntPtr lpRefData)
        {
            TaskDialogDriver driver = new TaskDialogDriver(hwnd);

            switch (msg)
            {
            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_BUTTON_CLICKED:
                if (ButtonClicked != null)
                {
                    ButtonClicked(this, new TaskDialogButtonEventArgs(driver, wParam.ToInt32()));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_CREATED:
                if (Created != null)
                {
                    Created(this, new TaskDialogEventArgs(driver));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_DESTROYED:
                if (Destroyed != null)
                {
                    Destroyed(this, new TaskDialogEventArgs(driver));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_DIALOG_CONSTRUCTED:
                if (DialogConstructed != null)
                {
                    DialogConstructed(this, new TaskDialogEventArgs(driver));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_EXPANDO_BUTTON_CLICKED:
                if (ExpandoButtonClicked != null)
                {
                    ExpandoButtonClicked(this, new TaskDialogExpandoEventArgs(driver, wParam != IntPtr.Zero));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_HELP:
                if (Help != null)
                {
                    Help(this, new TaskDialogEventArgs(driver));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_HYPERLINK_CLICKED:
                if (HyperlinkClicked != null)
                {
                    HyperlinkClicked(this, new TaskDialogHyperlinkEventArgs(driver, Marshal.PtrToStringUni(lParam)));
                }
                break;

            /*
             * case (uint)TASKDIALOG_NOTIFICATIONS.TDN_NAVIGATED:
             * if (Navigated != null)
             *  Navigated(this, new TaskDialogEventArgs(driver));
             * break;
             */
            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_RADIO_BUTTON_CLICKED:
                if (RadioButtonClicked != null)
                {
                    RadioButtonClicked(this, new TaskDialogButtonEventArgs(driver, wParam.ToInt32()));
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_TIMER:
                if (TimerTicked != null)
                {
                    TaskDialogTimerEventArgs args = new TaskDialogTimerEventArgs(driver, wParam.ToInt32());
                    TimerTicked(this, args);
                    if (args.ResetTickCount)
                    {
                        return(new IntPtr(1));
                    }
                }
                break;

            case (uint)TASKDIALOG_NOTIFICATIONS.TDN_VERIFICATION_CLICKED:
                if (VerificationClicked != null)
                {
                    VerificationClicked(this, new TaskDialogVerificationEventArgs(driver, wParam.ToInt32() == 1));
                }
                break;
            }
            return(IntPtr.Zero);
        }
예제 #2
0
 private IntPtr Callback(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, IntPtr lpRefData)
 {
     TaskDialogDriver driver = new TaskDialogDriver(hwnd);
     switch (msg)
     {
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_BUTTON_CLICKED:
             if (ButtonClicked != null)
                 ButtonClicked(this, new TaskDialogButtonEventArgs(driver, wParam.ToInt32()));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_CREATED:
             if (Created != null)
                 Created(this, new TaskDialogEventArgs(driver));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_DESTROYED:
             if (Destroyed != null)
                 Destroyed(this, new TaskDialogEventArgs(driver));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_DIALOG_CONSTRUCTED:
             if (DialogConstructed != null)
                 DialogConstructed(this, new TaskDialogEventArgs(driver));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_EXPANDO_BUTTON_CLICKED:
             if (ExpandoButtonClicked != null)
                 ExpandoButtonClicked(this, new TaskDialogExpandoEventArgs(driver, wParam != IntPtr.Zero));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_HELP:
             if (Help != null)
                 Help(this, new TaskDialogEventArgs(driver));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_HYPERLINK_CLICKED:
             if (HyperlinkClicked != null)
                 HyperlinkClicked(this, new TaskDialogHyperlinkEventArgs(driver, Marshal.PtrToStringUni(lParam)));
             break;
         /*
     case (uint)TASKDIALOG_NOTIFICATIONS.TDN_NAVIGATED:
         if (Navigated != null)
             Navigated(this, new TaskDialogEventArgs(driver));
         break;
          */
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_RADIO_BUTTON_CLICKED:
             if (RadioButtonClicked != null)
                 RadioButtonClicked(this, new TaskDialogButtonEventArgs(driver, wParam.ToInt32()));
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_TIMER:
             if (TimerTicked != null)
             {
                 TaskDialogTimerEventArgs args = new TaskDialogTimerEventArgs(driver, wParam.ToInt32());
                 TimerTicked(this, args);
                 if (args.ResetTickCount)
                     return new IntPtr(1);
             }
             break;
         case (uint)TASKDIALOG_NOTIFICATIONS.TDN_VERIFICATION_CLICKED:
             if (VerificationClicked != null)
                 VerificationClicked(this, new TaskDialogVerificationEventArgs(driver, wParam.ToInt32() == 1));
             break;
     }
     return IntPtr.Zero;
 }