diff --git a/Apollon.WPF/ViewModels/NavBarViewModel.cs b/Apollon.WPF/ViewModels/NavBarViewModel.cs index fcd9335..916709f 100644 --- a/Apollon.WPF/ViewModels/NavBarViewModel.cs +++ b/Apollon.WPF/ViewModels/NavBarViewModel.cs @@ -15,7 +15,6 @@ namespace Apollon.WPF.ViewModels { private readonly SelectedTournamentsStore _selectedTournamentsStore; - private Tournament SelectedTournament => _selectedTournamentsStore.SelectedTournament; public bool HasSelectedTournament => SelectedTournament != null; @@ -27,13 +26,12 @@ namespace Apollon.WPF.ViewModels public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum"; public string Location => SelectedTournament?.Location ?? "kein Ort"; public int Rounds => SelectedTournament?.Rounds ?? 0; - - public AddEditDetailsViewModel AddEditDetailsViewModel { get; } + public ICommand NavigateOverviewCommand { get; } public NavBarViewModel(NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore) { - NavigateOverviewCommand = new NavigateCommand(navigationStore, () => new OverviewViewModel(tournamentsStore, selectedTournamentsStore, modalNavigationStore,navigationStore)); - + NavigateOverviewCommand = new NavigateCommand(navigationStore, () => OverviewViewModel.LoadViewModel( selectedTournamentsStore, modalNavigationStore, tournamentsStore, navigationStore)); + _selectedTournamentsStore = selectedTournamentsStore; } } diff --git a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs index 81585cd..0dd0b56 100644 --- a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs @@ -52,7 +52,7 @@ namespace Apollon.WPF.ViewModels protected override void Dispose() { - _selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged; + _selectedTournamentStore.SelectedTournamentChanged -= SelectedTournamentStore_SelectedTournamentChanged; _tournamentStore.TournamentLoaded -= TournamentStore_TournamentLoaded; _tournamentStore.TournamentAdded -= TournamentStore_TournamentAdded;