static void Main(string[] args) { var zavod = new Zavod(); var commands = new Dictionary <ConsoleKey, ICommand> { [ConsoleKey.Spacebar] = new CreateWheelCommand(zavod), [ConsoleKey.Enter] = new CommandSimulator() }; var undone = true; while (undone) { var key = Console.ReadKey().Key; if (!commands.ContainsKey(key)) { break; } var command = commands[key]; command.Act(); } }
public CreateWheelCommand(Zavod zavod) { this.zavod = zavod; }