DroidExplorer.Controls.VistaTaskDialog.PrivateCallback C# (CSharp) Method

PrivateCallback() private method

The callback from the native Task Dialog. This prepares the friendlier arguments and calls the simplier callback.
private PrivateCallback ( [ hwnd, [ msg, [ wparam, [ lparam, [ refData ) : int
hwnd [ The window handle of the Task Dialog that is active.
msg [ The notification. A TaskDialogNotification value.
wparam [ Specifies additional noitification information. The contents of this parameter depends on the value of the msg parameter.
lparam [ Specifies additional noitification information. The contents of this parameter depends on the value of the msg parameter.
refData [ Specifies the application-defined value given in the call to TaskDialogIndirect.
return int
        private int PrivateCallback( [In] IntPtr hwnd, [In] uint msg, [In] UIntPtr wparam, [In] IntPtr lparam, [In] IntPtr refData )
        {
            VistaTaskDialogCallback 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.
            VistaActiveTaskDialog activeDialog = new VistaActiveTaskDialog ( hwnd );
            VistaTaskDialogNotificationArgs args = new VistaTaskDialogNotificationArgs ( );
            args.Notification = ( VistaTaskDialogNotification ) msg;
            switch ( args.Notification ) {
              case VistaTaskDialogNotification.ButtonClicked:
              case VistaTaskDialogNotification.RadioButtonClicked:
            args.ButtonId = ( int ) wparam;
            break;
              case VistaTaskDialogNotification.HyperlinkClicked:
            args.Hyperlink = Marshal.PtrToStringUni ( lparam );
            break;
              case VistaTaskDialogNotification.Timer:
            args.TimerTickCount = ( uint ) wparam;
            break;
              case VistaTaskDialogNotification.VerificationClicked:
            args.VerificationFlagChecked = ( wparam != UIntPtr.Zero );
            break;
              case VistaTaskDialogNotification.ExpandoButtonClicked:
            args.Expanded = ( wparam != UIntPtr.Zero );
            break;
            }

            return ( callback ( activeDialog, args, this.callbackData ) ? 1 : 0 );
              }

              return 0; // false;
        }