/// <summary> /// method to manage the application setup and control loop /// </summary> private void ManageApplicationLoop() { MenuOption userMenuChoice; _consoleView.DisplayWelcomeScreen(); // // setup initial salesperson account // _salesperson = _consoleView.DisplaySetupAccount(); // // application loop // while (_usingApplication) { // // get a menu choice from the ConsoleView object // userMenuChoice = _consoleView.DisplayGetUserMenuChoice(); // // choose an action based on the user's menu choice // switch (userMenuChoice) { case MenuOption.None: break; case MenuOption.Travel: Travel(); break; case MenuOption.DisplayCities: DisplayCities(); break; case MenuOption.DisplayAccountInfo: DisplayAccountInfo(); break; case MenuOption.Exit: _usingApplication = false; break; default: break; } } _consoleView.DisplayClosingScreen(); // // close the application // Environment.Exit(1); }
/// <summary> /// method to manage the application setup and control loop /// </summary> private void ManageApplicationLoop() { MenuOption userMenuChoice; bool accountExist = false; _consoleView.DisplayWelcomeScreen(); // // application loop // while (_usingApplication) { // // get a menu choice from the ConsoleView object // userMenuChoice = _consoleView.DisplayGetUserMenuChoice(); // // choose an action based on the user's menu choice // switch (userMenuChoice) { case MenuOption.None: break; case MenuOption.SetupAccount: city = SetupAccount(); accountExist = true; break; case MenuOption.UpdateAccount: if (accountExist) { UpdateAccount(); } else { Error(); } break; case MenuOption.Travel: if (accountExist) { city = Travel(); } else { Error(); } break; case MenuOption.Buy: if (accountExist) { PurchaseMenu(); } else { Error(); } break; case MenuOption.Sell: if (accountExist) { Sell(); } else { Error(); } break; case MenuOption.DisplayInventory: if (accountExist) { DisplayInventory(); } else { Error(); } break; case MenuOption.DisplayCities: if (accountExist) { DisplayCities(); } else { Error(); } break; case MenuOption.DisplayAccountInfo: if (accountExist) { DisplayAccountInfo(); } else { Error(); } break; case MenuOption.SaveAccountInfo: if (accountExist) { DisplaySaveAccountInfo(); } else { Error(); } break; case MenuOption.LoadAccountInfo: DisplayLoadAcoountInfo(); accountExist = true; break; case MenuOption.Exit: _usingApplication = false; break; default: break; } } _consoleView.DisplayClosingScreen(); // // close the application // Environment.Exit(1); }