public void Run(IRegistry registry) { IBoard board = registry.Board; IProcessUserInput processUserInput = registry.ProcessUserInput; IShowMessageToUser showMessageToUser = registry.ShowMessageToUser; IExecuteUserChoice executeUserChoice = registry.ExecuteUserChoice; IDrawing drawing = registry.Drawing; board.SetBoardSize(40, 20); drawing.DrawBoard(board); showMessageToUser.ShowHelloToUser(); showMessageToUser.ShowInstructionForUser("Enter the action to affect the board:"); while (true) { int currentChoice = processUserInput.GetChoice(); if (executeUserChoice.IsExit(currentChoice)) { break; } if (!executeUserChoice.IsValid(currentChoice)) { showMessageToUser.ShowInstructionForUser("Ivalid input! Please, try again, choose from the options."); continue; } executeUserChoice.MakeFigure(board, drawing, currentChoice); } }
public ConsoleAppRegistry() { this.Board = new Board(); this.ProcessUserInput = new ConsoleProcessingUserInput(); this.ShowMessageToUser = new ConsoleShowMessageToUser(); this.Drawing = new ConsoleDrawing(); this.ExecuteUserChoice = new NumericExecuteUserChoice(); this.ProcessUserInput = new ConsoleProcessingUserInput(); }