public MediatorPattern() { var playerController = new PlayerController(); var playerControllerButton1 = new PauseButton(playerController); var playerControllerButton2 = new StartButton(playerController); var playerControllerButton3 = new StopButton(playerController); playerControllerButton1.Click(); playerControllerButton2.Click(); playerControllerButton3.Click(); }
public void Register(PlayerControllerButton button) { switch (button.GetType().ToString()) { case "DesignModel.StartButton": startButton = (StartButton) button; break; case "DesignModel.StopButton": stopButton = (StopButton) button; break; case "DesignModel.PauseButton": pauseButton = (PauseButton) button; break; } }