示例#1
0
        private static void EnterCommand()
        {
            Console.WriteLine();
            Console.Write("Please enter command, followed by enter: ");

            var input = Console.ReadLine();

            var command = _commandParser.Parse(input);

            if (command != null)
            {
                try
                {
                    _rover.AddCommand(command);

                    _flashMessage = FlashMessage.Success("Command added successfully");
                }
                catch (Exception ex)
                {
                    _flashMessage = FlashMessage.Error(ex.Message);
                }
            }
            else
            {
                _flashMessage = FlashMessage.Warning("Invalid command");
            }
        }
示例#2
0
        private static void ExecuteCommands()
        {
            try
            {
                var result = _rover.ExecuteCommands();

                _flashMessage = FlashMessage.Success($"Rover position: {result}");
            }
            catch (Exception ex)
            {
                _flashMessage = FlashMessage.Error(ex.Message);
            }
        }