private void UIElement_OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { MenuToggleButton.IsChecked = false; TournamentViewModel selectedTournament = this.TournamentsListBox.SelectedItem as TournamentViewModel; EditRacesControlViewModel vm = _conductRacesWindow?.DataContext as EditRacesControlViewModel; vm?.Dispose(); if (_conductRacesWindow != null) { vm = null; if (selectedTournament != null) { vm = new EditRacesControlViewModel(selectedTournament.TournamentID); } _conductRacesWindow.DataContext = vm; } }
private void ConductRaces_Click(object sender, RoutedEventArgs e) { if (_conductRacesWindow != null) { if (_conductRacesWindow.IsLoaded) { _conductRacesWindow.Close(); } _conductRacesWindow = null; } TournamentViewModel vm = this.TournamentsListBox.SelectedItem as TournamentViewModel; _conductRacesWindow = new ConductRacesWindow { Owner = this, DataContext = new EditRacesControlViewModel(vm.TournamentID) }; _conductRacesWindow.Closed += ConductRacesWindows_Closed; _conductRacesWindow.Show(); }
private void EditEvent_Click(object sender, RoutedEventArgs e) { TournamentViewModel vm = this.TournamentsListBox.SelectedItem as TournamentViewModel; vm?.EditTournament(); }