public void Run() { _menu.AddCommandToDictionaryMenu((int)PhoneSimulatorCommand.BeginConnection, BeginConnection); _menu.AddCommandToDictionaryMenu((int)PhoneSimulatorCommand.SendTextMessage, SendTextMessage); _menu.AddCommandToDictionaryMenu((int)PhoneSimulatorCommand.ShowAccountBalance, ShowAccountBalance); _menu.AddCommandToDictionaryMenu((int)PhoneSimulatorCommand.Exit, Exit); var phoneBl = ChoosePhoneToSimulate(); while (!shouldExit) { _ioHelper.ClearConsole(); _menu.PrintOutCommands(); var command = _ioHelper.GetIntFromUser(); try { shouldExit = _menu.RunCommandFromDictionaryMenu(command, phoneBl.Id); } catch (Exception e) { _ioHelper.PrintMessageWithConsoleRead($"Run into an error {e.Message} {Environment.NewLine}To get back to menu press any key..."); continue; } } }
private void Run() { _menu.AddCommandToDictionaryMenu((int)SubscriberSystemCommand.AddSubscriber, AddSubscriber); _menu.AddCommandToDictionaryMenu((int)SubscriberSystemCommand.AddAnOffer, AddAnOffer); _menu.AddCommandToDictionaryMenu((int)SubscriberSystemCommand.AssignOfferToTheSubscriber, AssignOfferToTheSubscriber); _menu.AddCommandToDictionaryMenu((int)SubscriberSystemCommand.GenerateInvoice, GenerateInvoice); _menu.AddCommandToDictionaryMenu((int)SubscriberSystemCommand.ExportInvoice, ExportInvoice); _menu.AddCommandToDictionaryMenu((int)SubscriberSystemCommand.Exit, Exit); while (true) { _ioHelper.ClearConsole(); _menu.PrintOutCommands(); var command = _ioHelper.GetIntFromUser(); try { _menu.RunCommandFromDictionaryMenu(command); } catch (Exception e) { _ioHelper.PrintMessageWithConsoleRead($"Run into an error {e.Message} {Environment.NewLine}To get back to menu press any key"); continue; } } }