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

namespace CommonHelpers {

//**************************************************************************************************
partial class HConsole {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="InvalidOperationException" />
/// <exception cref="HAbortConsoleInputException" />
public void PerformExitionDialog(bool insertBlankLine)
{
   if (insertBlankLine)
      Print();
   OutputDialogPrompt( ExitionDialogPromptMessage );
   AcceptInputKey( ConsoleKey.Enter, ConsoleKey.Escape );
   Print();
}

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

/// <exception cref="InvalidOperationException" />
/// <exception cref="HAbortConsoleInputException" />
public void PerformContinuationDialog(bool insertBlankLine)
{
   if (insertBlankLine)
      Print();
   OutputDialogPrompt( ContinuationDialogPromptMessage );
   AcceptInputKey( ConsoleKey.Enter, ConsoleKey.Escape );
   Print();
}

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

/// <exception cref="InvalidOperationException" />
/// <exception cref="HAbortConsoleInputException" />
public bool PerformConfirmationDialog(bool insertBlankLine,string caption)
{
   return PerformDialog( insertBlankLine, caption,
      new string[]{ ConfirmationDialogActionText_Confirm },
      new ConsoleKey[]{ ConsoleKey.Enter },
      ConfirmationDialogActionText_Cancel ) == 0;
}

/// <exception cref="InvalidOperationException" />
/// <exception cref="HAbortConsoleInputException" />
public bool PerformConfirmationDialog( bool insertBlankLine,
                                       string captionFmt,
                                       params string[] parameters )
{
   return PerformConfirmationDialog(false,string.Format(captionFmt,parameters));
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HConsole
//**************************************************************************************************

} // CommonHelpers
