Navigation Service and Cleanup UI

This commit is contained in:
Natlinux
2022-11-27 21:52:18 +01:00
parent 3911dd66e8
commit 56a433876e
14 changed files with 441 additions and 345 deletions

View File

@@ -8,5 +8,11 @@ namespace Apollon.WPF.ViewModels
{
public class ArchersViewModel : ViewModelBase
{
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
public ArchersViewModel(NavBarPreparationViewModel navBarPreparationViewModel)
{
NavBarPreparationViewModel = navBarPreparationViewModel;
}
}
}

View File

@@ -8,5 +8,11 @@ namespace Apollon.WPF.ViewModels
{
public class ClassesViewModel : ViewModelBase
{
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
public ClassesViewModel(NavBarPreparationViewModel navBarPreparationViewModel)
{
NavBarPreparationViewModel = navBarPreparationViewModel;
}
}
}

View File

@@ -1,5 +1,6 @@
using Apollon.Domain.Models;
using Apollon.WPF.Commands;
using Apollon.WPF.Services;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
@@ -14,13 +15,14 @@ namespace Apollon.WPF.ViewModels
{
public TournamentDetailsViewModel TournamentDetailsViewModel { get; }
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
public ICommand NavigateOverviewCommand { get; }
public GroupsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
{
{
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore);
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore));
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(new NavigationService<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore)));
}
}
}

View File

@@ -1,4 +1,5 @@
using Apollon.WPF.Commands;
using Apollon.WPF.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,7 +13,16 @@ namespace Apollon.WPF.ViewModels
{
public ICommand NavigateOverviewCommand { get;}
public ICommand NavigateGroupsCommand { get;}
public ICommand NavigateClassesCommand { get;}
public ICommand NavigateArchersCommand { get;}
public ICommand NavigateClassesCommand { get;}
public ICommand NavigateArchersCommand { get;}
public NavBarPreparationViewModel(NavigationService<OverviewViewModel> overviewNavigationService, NavigationService<GroupsViewModel> groupNavigationService,
NavigationService<ClassesViewModel> classNavigationService, NavigationService<ArchersViewModel> archersNavigationService)
{
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(overviewNavigationService);
NavigateGroupsCommand = new NavigateCommand<GroupsViewModel>(groupNavigationService);
NavigateClassesCommand = new NavigateCommand<ClassesViewModel>(classNavigationService);
NavigateArchersCommand = new NavigateCommand<ArchersViewModel>(archersNavigationService);
}
}
}

View File

@@ -1,5 +1,6 @@
using Apollon.Domain.Models;
using Apollon.WPF.Commands;
using Apollon.WPF.Services;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
@@ -35,7 +36,8 @@ namespace Apollon.WPF.ViewModels
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
NavigatePreparationCommand = new NavigateCommand<GroupsViewModel>(navigationStore, () => new GroupsViewModel(selectedTournamentStore, navigationStore, modalNavigationStore, tournamentsStore));
NavigatePreparationCommand = new NavigateCommand<GroupsViewModel>(new NavigationService<GroupsViewModel> (
navigationStore, () => new GroupsViewModel( _selectedTournamentStore, navigationStore, modalNavigationStore, tournamentsStore)));
}
protected override void Dispose()

View File

@@ -1,12 +1,7 @@
using Apollon.WPF.Commands;
using Apollon.Domain.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Apollon.WPF.Services;
namespace Apollon.WPF.ViewModels
{
@@ -58,7 +53,8 @@ namespace Apollon.WPF.ViewModels
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
NavigateNameListCommand = new NavigateCommand<NameListViewModel>(navigationStore, () => new NameListViewModel());
NavigateNameListCommand = new NavigateCommand<NameListViewModel>(new NavigationService<NameListViewModel>(
navigationStore, () => new NameListViewModel()));
}