Exemplo n.º 1
0
        private async Task AddCustomLap()
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog {
                DefaultExt = ".lap; .plap", Filter = "Lap Files (*.lap, *.plap)|*.lap; *.plap"
            };
            bool?result = dlg.ShowDialog();

            if (result == false)
            {
                return;
            }

            string filename       = dlg.FileName;
            string fileCustomName = await _userInputProvider.GetUserInput("Enter Lap Name:", $"Ex-{Path.GetFileNameWithoutExtension(filename)}");

            await _telemetryLoadController.LoadLap(new FileInfo(filename), fileCustomName);
        }
Exemplo n.º 2
0
        private void PlayPlayerMove()
        {
            _gamePrinter.PrintPlayerTurn();

            var validPlayerTurn = false;

            while (!validPlayerTurn)
            {
                try
                {
                    var shotKey          = _userInputProvider.GetUserInput();
                    var playerShotResult = _gameManager.PlayPlayerMove(shotKey);
                    _gamePrinter.PrintShotResult(playerShotResult);
                    validPlayerTurn = true;
                }
                catch (ArgumentException exception)
                {
                    _gamePrinter.PrintErrorMessage(exception.Message);
                    _gamePrinter.PrintPlayerTurn();
                }
            }
        }