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 AppLogic(IMessenger messenger, IBoardHandler boardHandler, IProcessUserInput processUserInput) { _messenger = messenger ?? throw new ArgumentNullException(); _boardHandler = boardHandler ?? throw new ArgumentNullException(); _processUserInput = processUserInput ?? throw new ArgumentNullException(); }