static void Main(string[] args) { _dialogConsole = new DialogConsole(); string input; string exitCommand = "exit"; _dialogConsole.DisplayUser("Hello !"); _dialogConsole.DisplayUser($"Welcome, type your name to create a bank account or \"{exitCommand}\" to exit the application"); input = _dialogConsole.GetUserAnswer(); if (input == exitCommand) { return; } _dialogConsole.DisplayUser($"Thank you {input} for creating your bank account"); AccountInitialization(input); while (input != exitCommand) { DisplayAvailableActions(); input = _dialogConsole.GetUserAnswer(); _interpreter.ExecuteAction(input, _myAccount); } }
private static void DisplayAvailableActions() { IEnumerable <ActionEnum> commands = _interpreter.GetAvailableActions(); _dialogConsole.DisplayUser($"{Environment.NewLine}Which operation do you want to proceed ?"); foreach (ActionEnum actionEnum in commands) { _dialogConsole.DisplayUser($"{Convert.ToInt32(actionEnum)} - {actionEnum.ToString()}"); } }
protected bool GetAmountFromUser() { Amount = 0; DialogConsole.DisplayUser("How much ?"); string input = DialogConsole.GetUserAnswer(); decimal amount; if (decimal.TryParse(input, out amount)) { Amount = amount; return(true); } return(false); }