protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); // Create model Game game = new Game(NUMBER_OF_SHOTS,NUMBER_OF_ANIMALS); // Create view MainWindow gameWindow = new MainWindow(WIDTH, HEIGHT); GameView GameView = new GameView(game, WIDTH, HEIGHT); // view gameWindow.GameGrid.Children.Add(GameView); gameWindow.Show(); // Add view to model game.AddView(GameView); // Create controller GameController gameController = new GameController(game); gameWindow.KeyDown += gameController.Move.GameView_KeyDown; // Add controller to view GameView.AddController(gameController); // Start game game.Start(); }
public void AddController(GameController gameController) { this.controller = gameController; }