private void ExecuteComputerCommand(MyMasterMindCommands command) { ComputerCommand = command; ClearBoard(); EnableCommands(new List <MyMasterMindCommands>() { MyMasterMindCommands.Cancel }); DisableCommands(new List <MyMasterMindCommands>() { MyMasterMindCommands.ComputerSlow, MyMasterMindCommands.ComputerFast, MyMasterMindCommands.User, MyMasterMindCommands.Clear, MyMasterMindCommands.Check }); Game = new MyMasterMindGame(); BackgroundWorker = new BackgroundWorker { WorkerReportsProgress = true }; BackgroundWorker.DoWork += BackGroundComputerDoWork; BackgroundWorker.RunWorkerCompleted += BackGroundComputerCompleted; BackgroundWorker.ProgressChanged += BackgroundWorkerComputerProgressChanged; BackgroundWorker.WorkerSupportsCancellation = true; BackgroundWorker.RunWorkerAsync(this); }
private void UserCommand(object sender, EventArgs e) { ClearBoard(); EnableCommands(new List <MyMasterMindCommands>() { MyMasterMindCommands.Clear }); DisableCommands(new List <MyMasterMindCommands>() { MyMasterMindCommands.ComputerSlow, MyMasterMindCommands.ComputerFast, MyMasterMindCommands.User, MyMasterMindCommands.Cancel, MyMasterMindCommands.Check }); Game = new MyMasterMindGame(); MasterMindBoard.MarkGuessCell(0, CellMark.ForInput); UserPlaying = true; }