예제 #1
0
        /// <summary>
        /// Alkalmazás indulásának eseménykezelője.
        /// </summary>
        private void App_Startup(object sender, StartupEventArgs e)
        {
            _dataAccess = new DBPersistence();

            _newGame = new NewGameWindow();

            _model = new TicTacToeGameModel(_dataAccess);
            //_model.GameWon += new EventHandler<GameWonEventArgs>(Model_GameWon);
            _model.NewGame();

            _viewModel           = new TicTacToeViewModel(_model);
            _viewModel.LoadGame += new EventHandler(ViewModel_LoadGame); // kezeljük a nézetmodell eseményeit
            _viewModel.SaveGame += new EventHandler(ViewModel_SaveGame);
            _viewModel.GameExit += new EventHandler(ViewModel_GameExit);
            _viewModel.NewGame  += new EventHandler(ViewModel_NewGame);
            _model.GameOver     += new EventHandler <GameOverEventArgs>(Model_GameOver);

            _window             = new MainGameWindow();
            _window.DataContext = _viewModel;
            _window.Show();
        }