protected override void OnClosing(CancelEventArgs e) { GamePlayViewModel data = GamePlayViewModel.getInstaince(); data.gamePlay.gameState.stop(); base.OnClosing(e); Application.Current.Shutdown(); }
public void Execute(object parameter) { if (parameter.ToString() == "gamePlay") { Debug.WriteLine("View update to gameplay view command fired"); GamePlayViewModel.getInstaince().gamePlay.gameState.play(); this.viewModel.selectedViewModel = GamePlayViewModel.getInstaince(); } else if (parameter.ToString() == "mainMenue") { Debug.WriteLine("View update to main menue view command fired"); this.viewModel.selectedViewModel = MainMenueViewModel.getInstaince(); } else if (parameter.ToString() == "controls") { Debug.WriteLine("View update to controls menue view command fired"); this.viewModel.selectedViewModel = ControlsViewModel.getInstaince(); } }
public GameplayView() { InitializeComponent(); data = GamePlayViewModel.getInstaince(); for (int i = 0; i < 20; i++) { RadarGrid.RowDefinitions.Add(new RowDefinition()); RadarGrid.ColumnDefinitions.Add(new ColumnDefinition()); Button button = new Button(); button.SetValue(Grid.RowProperty, i); button.SetValue(Grid.ColumnProperty, i); } for (int j = 0; j < 20; j++) { TextBlock txtBox = new TextBlock(); txtBox.Text = j.ToString(); txtBox.Foreground = Brushes.WhiteSmoke; Grid.SetColumn(txtBox, 0); Grid.SetRow(txtBox, j); RadarGrid.Children.Add(txtBox); } for (int j = 1; j < 20; j++) { TextBlock txtBox = new TextBlock(); txtBox.Text = j.ToString(); txtBox.Foreground = Brushes.WhiteSmoke; Grid.SetColumn(txtBox, j); Grid.SetRow(txtBox, 20); RadarGrid.Children.Add(txtBox); } }