//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// WFX satellite library | Author: Sergei Y.Kitáev
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;

using WF = System.Windows.Forms;

using CommonHelpers;

namespace WFX {

//**************************************************************************************************
partial class MessageBox {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static bool? YesNoCancelDialog([HOptional] ShowMessageExtraInfo extraInfo,string text)
{
   return YesNoCancelDialog( extraInfo, (WF.IWin32Window)null, text );
}

//--------------------------------------------------------------------------------------------------

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       [HOptional] WF.IWin32Window owner, string text )
{
   return YesNoCancelDialog( extraInfo, owner, text, null );
}

//==================================================================================================

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       string text, [HOptional] string caption )
{
   return YesNoCancelDialog( extraInfo, (WF.IWin32Window)null, text, caption);
}

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       string text, [HOptional] string caption,
                                       WF.DialogResult defaultResult )
{
   return YesNoCancelDialog( extraInfo, (WF.IWin32Window)null,
                             text, caption, WF.DialogResult.Yes );
}

//--------------------------------------------------------------------------------------------------

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       [HOptional] WF.IWin32Window owner, string text,
                                       [HOptional] string caption )
{
   return YesNoCancelDialog( extraInfo, owner, text, caption, YesNoCancelDialogDefaultIcon );
}

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       [HOptional] WF.IWin32Window owner,
                                       string text, [HOptional] string caption,
                                       WF.DialogResult defaultResult )
{
   return YesNoCancelDialog( extraInfo, owner, text, caption,
      YesNoCancelDialogDefaultIcon, WF.DialogResult.Yes );
}

//==================================================================================================

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       string text, [HOptional] string caption,
                                       WF.MessageBoxIcon icon )
{
   return YesNoCancelDialog( extraInfo, null, text, caption, icon );
}

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       string text, [HOptional] string caption,
                                       WF.MessageBoxIcon icon,
                                       WF.DialogResult defaultResult )
{
   return YesNoCancelDialog( extraInfo, null, text, caption, icon, WF.DialogResult.Yes );
}

//--------------------------------------------------------------------------------------------------

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       [HOptional] WF.IWin32Window owner, string text,
                                       [HOptional] string caption, WF.MessageBoxIcon icon )
{
   return YesNoCancelDialog( extraInfo, owner, text, caption, icon, WF.DialogResult.Yes );
}

public static bool? YesNoCancelDialog( [HOptional] ShowMessageExtraInfo extraInfo,
                                       [HOptional] WF.IWin32Window owner, string text,
                                       [HOptional] string caption, WF.MessageBoxIcon icon,
                                       WF.DialogResult defaultResult )
{
   if (!HOps.IsOneOf( defaultResult,
      WF.DialogResult.Yes, WF.DialogResult.No, WF.DialogResult.Cancel ))
      throw new ArgumentException( "Incorrect value for default result." );
   switch ( ShowMessage( extraInfo, owner, text, caption, WF.MessageBoxButtons.YesNoCancel,
                         icon, defaultResult ) )
   {
   case WF.DialogResult.Yes: return true;
   case WF.DialogResult.No : return false;
   default: return null;
   }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // MessageBox
//**************************************************************************************************

} // WFX
