private void InitMessageHandlers() { // Receive any move and update the primary game's state. CommitMoveMessage.Register(MessengerInstance, this, action => UpdateGame(action, PrimaryGame)); // These message handlers stay irrespective of the ActiveMode UndoMessage.Register(MessengerInstance, this, () => Undo(ModeSpecificGame())); RedoMessage.Register(MessengerInstance, this, () => Redo(ModeSpecificGame())); SwitchGameViewModeMessage.Register(MessengerInstance, this, mode => ActiveMode = mode); PauseGameMessage.Register(MessengerInstance, this, () => _aiLoopCanRun = false); // someone requested that the current state of the game be saved RequestSaveToGameScreenMessage.Register( MessengerInstance, this, () => { SaveGameMessage.Send(MessengerInstance, (GameId, PrimaryGame.Memento)); PrimaryNeedsSaving = false; });
private void button1_Click(object sender, EventArgs e) { UndoMessage newUndo = new UndoMessage(); controller.SendMessage(newUndo); }