using System;
using System.Reflection;

using CommonHelpers;

namespace ConsoleCalculator {

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

/// <summary>
/// This is, in fact, the main function in this application.
/// </summary>
public static void Run()
{
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Displaying logo information, checking command line arguments, displaying some other info:

   PrintLogoInformation();

   if (HProgram.HasEntryPointArguments)
      throw new HAppFailureException(
         "No command line arguments were expected.",
         AppExitFailureExceptionMarkers.UnexpectedArguments );

   PrintHotKeysInfo();

   HSound.Play( Sounds.Startup );

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This cycle invokes new calculation many times, until the user will deside to leave the app.:

   for (;;)
   {
      CON.PrintDoubleSplitter(true,true);

      // Calling new calculation sequence routine:
      PerformCalculation();

      CON.PrintDoubleSplitter(true,true);

      CON.PrintFeaturedInscription(
         //CON.FaintColor,
         "Calculation has been reset." );

      // Proceeding new calculation dialog:
      if (CON.PerformDialog(
         true,
         "Confirm proceeding another calculation:",
         new string[] { "New calculation", "Exit from the application" },
         new ConsoleKey[]{ ConsoleKey.Enter, ConsoleKey.X },
         new ConsoleModifiers[]{ 0, ConsoleModifiers.Alt }
      )==1)
         break;

      Console.Clear();
      PrintLogoInformation();
      PrintHotKeysInfo();
   }

   SayGoodbye();

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}

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

} // ConsoleCalculator
