Exemplo n.º 1
0
        private void FinishRaceButton_Click(object sender, RoutedEventArgs e)
        {
            EditRacesControlViewModel vm        = (this.DataContext as EditRacesControlViewModel) ?? throw new Exception("DataContext is not set!");
            Button            currentRaceButton = sender as Button;
            EditRaceViewModel race = currentRaceButton.DataContext as EditRaceViewModel;

            vm.StopRace(race);
        }
Exemplo n.º 2
0
        private void ConductRacesWindows_Closed(object sender, EventArgs e)
        {
            if (_conductRacesWindow != null)
            {
                EditRacesControlViewModel vm = _conductRacesWindow.DataContext as EditRacesControlViewModel;
                vm?.Dispose();

                _conductRacesWindow.Closed -= ConductRacesWindows_Closed;
            }
        }
Exemplo n.º 3
0
        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;
            }
        }