示例#1
0
        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);
            }
        }
示例#2
0
        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()}");
            }
        }
示例#3
0
        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);
        }