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;
}