Esempio n. 1
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            view = new MainWindow();

            model = new AsteroidsGame(new GameRules(view.Width, view.Height), FPS);

            viewModel       = new AsteroidsViewModel(model);
            viewModel.Exit += ViewModel_Exit;

            view.DataContext = viewModel;
            view.Show();
        }
Esempio n. 2
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            _board     = new Board(5, 5);
            _fieldSize = 100;
            _viewModel = new AsteroidsViewModel(new AsteroidsModel(_board.Width, _board.Width));

            _viewModel.OnNewGame       += new EventHandler(ViewModel_OnNewGame);
            _viewModel.OnGameOver      += new EventHandler <String>(ViewModel_OnGameOver);
            _viewModel.OnFieldsChanged += new EventHandler <FieldsChangedEventArgs>(ViewModel_OnFieldsChanged);

            _mainWindow             = new MainWindow();
            _mainWindow.DataContext = _viewModel;

            _mainWindow.Closed += new EventHandler(MainWindow_Closed);
            _mainWindow.Show();
        }
Esempio n. 3
0
        public App()
        {
            _board     = new Board(5, 5);
            _viewModel = new AsteroidsViewModel(new AsteroidsModel(_board.Width, _board.Width));

            _gamePage = new MainPage();

            _viewModel.OnNewGame       += new EventHandler(_gamePage.OnNewGame);
            _viewModel.OnGameOver      += new EventHandler <String>(_gamePage.OnGameOver);
            _viewModel.OnFieldsChanged += new EventHandler <FieldsChangedEventArgs>(_gamePage.OnFieldsChanged);

            _gamePage.BindingContext = _viewModel;

            _mainPage = new NavigationPage(_gamePage);

            MainPage = _mainPage;
        }