using System;
using System.Threading;
using System.Globalization;
using System.Reflection;

using CommonHelpers;

namespace ConsoleCalculator {

//**************************************************************************************************
static partial class Program {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

static void PrintLogoInformation()
{
   Console.Clear();
   CON.PrintTitleHeader( false, true,
      "{0} {1} coded by {2}:",
      ConsoleCalculator_Info.Title,
      CON.LongDash,
      CommonHelpers_Info.Authors );
}

static void PrintHotKeysInfo()
{
   CON.PrintDialogKeysLegend
   (
      "Keys for operand input:",
      new string[]{ "Accept input", "Clear input field" },
      new ConsoleKey[]{ ConsoleKey.Enter, ConsoleKey.Backspace },
      new ConsoleModifiers[]{ 0, ConsoleModifiers.Control }
   );
   CON.PrintDialogKeysLegend
   (
      true,
      "Operation keys (on numeric keyboard, or their alternatives):",
      _OperationCaptions_,
      _MainOperationKeyArray_,
      _MainOperationModifierArray_
   );
   CON.PrintDialogKeysLegend
   (
      true,
      "Everywhere in calculation routine:",
      new string[]{ "Abandon (cancel currently active procedure)" },
      new ConsoleKey[]{ ConsoleKey.Escape }
   );
}

static void SayGoodbye()
{
   CON.Print();
   CON.OutputExclamation("Bye! ");
   CON.PrintFaint("Good luck!");

   CON.PrintTitleFooter( true,
      "{0} {1} {2}",
      ConsoleCalculator_Info.SimpleTitle,
      CON.LongDash, "OUT"
   );
   HSound.SyncPlay(Sounds.Exit);
}

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

static void PrintRedefineLastOperation()
{
   CON.PrintFaint(true,"<< Redefine the operation: >>");
}

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

static void ReportErrorRedefineOperand(string message)
{
   CON.ReportError( message );
   CON.PrintFaint("<< Redefine the operand: >>");
}

static void ReportErrorRedefineOperand(Exception e)
{
   ReportErrorRedefineOperand( HException.GetErrorMessage(e) );
}

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

static void ReportErrorRedefineOperation(string message)
{
   CON.ReportError( message );
   PrintRedefineLastOperation();
}

static void ReportErrorRedefineOperation(Exception e)
{
   ReportErrorRedefineOperation( HException.GetErrorMessage(e) );
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // Program
//**************************************************************************************************

} // ConsoleCalculator
