first NavBar finish
This commit is contained in:
@@ -4,6 +4,7 @@ using Apollon.Domain.Queries;
|
||||
using Apollon.EntityFramework;
|
||||
using Apollon.EntityFramework.Commands;
|
||||
using Apollon.EntityFramework.Queries;
|
||||
using Apollon.WPF.Services;
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -31,6 +32,7 @@ namespace Apollon.WPF
|
||||
private readonly IDeleteTournamentCommand _deleteTournamentCommand;
|
||||
private readonly TournamentsStore _tournamentStore;
|
||||
private readonly SelectedTournamentsStore _selectedTournamentStore;
|
||||
private readonly NavBarPreparationViewModel _navBarPreparationViewModel;
|
||||
|
||||
public App()
|
||||
{
|
||||
@@ -46,7 +48,13 @@ namespace Apollon.WPF
|
||||
_deleteTournamentCommand = new DeleteTournamentCommand(_tournamentsDbContextFactory);
|
||||
_tournamentStore = new TournamentsStore(_getAllTournamentQuery, _createTournamentCommand, _updateTournamentCommand, _deleteTournamentCommand);
|
||||
_selectedTournamentStore = new SelectedTournamentsStore(_tournamentStore);
|
||||
|
||||
_navBarPreparationViewModel = new NavBarPreparationViewModel(CreateOverviewNavigationService(),
|
||||
CreateGroupsNavigationService(),
|
||||
CreateClassesNavigationService(),
|
||||
CreateArchersNavigationService());
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
using(ApplicationDbContext context = _tournamentsDbContextFactory.Create())
|
||||
@@ -58,13 +66,17 @@ namespace Apollon.WPF
|
||||
_selectedTournamentStore,
|
||||
_modalNavigationStore,
|
||||
_tournamentStore,
|
||||
_navigationStore);
|
||||
_navigationStore,
|
||||
CreateGroupsNavigationService());
|
||||
|
||||
_navigationStore.CurrentViewModel = OverviewViewModel.LoadViewModel(
|
||||
_selectedTournamentStore,
|
||||
_modalNavigationStore,
|
||||
_tournamentStore,
|
||||
_navigationStore);
|
||||
_navigationStore,
|
||||
CreateGroupsNavigationService());
|
||||
|
||||
|
||||
|
||||
MainWindow = new MainWindow()
|
||||
{
|
||||
@@ -74,5 +86,29 @@ namespace Apollon.WPF
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
|
||||
private NavigationService<OverviewViewModel> CreateOverviewNavigationService()
|
||||
{
|
||||
return new NavigationService<OverviewViewModel>(
|
||||
_navigationStore, () => OverviewViewModel.LoadViewModel(_selectedTournamentStore, _modalNavigationStore, _tournamentStore, _navigationStore, CreateGroupsNavigationService()));
|
||||
}
|
||||
|
||||
private NavigationService<GroupsViewModel> CreateGroupsNavigationService()
|
||||
{
|
||||
return new NavigationService<GroupsViewModel>(
|
||||
_navigationStore, () => new GroupsViewModel( _navBarPreparationViewModel, _selectedTournamentStore, _navigationStore, _modalNavigationStore, _tournamentStore, CreateGroupsNavigationService()));
|
||||
}
|
||||
|
||||
private NavigationService<ClassesViewModel> CreateClassesNavigationService()
|
||||
{
|
||||
return new NavigationService<ClassesViewModel>(
|
||||
_navigationStore, ()=> new ClassesViewModel(_navBarPreparationViewModel, _selectedTournamentStore));
|
||||
}
|
||||
|
||||
private NavigationService<ArchersViewModel> CreateArchersNavigationService()
|
||||
{
|
||||
return new NavigationService<ArchersViewModel>(
|
||||
_navigationStore, () => new ArchersViewModel(_navBarPreparationViewModel, _selectedTournamentStore));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Apollon.WPF.Commands
|
||||
await _tournamentStore.Add(tournament);
|
||||
|
||||
_modalNavigationStore.Close();
|
||||
_navigationStore.CurrentViewModel = new GroupsViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore);
|
||||
//_navigationStore.CurrentViewModel = new GroupsViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,10 +9,12 @@ namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public class ArchersViewModel : ViewModelBase
|
||||
{
|
||||
public TournamentDetailsViewModel TournamentDetailsViewModel { get; }
|
||||
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
|
||||
|
||||
public ArchersViewModel(NavBarPreparationViewModel navBarPreparationViewModel)
|
||||
public ArchersViewModel(NavBarPreparationViewModel navBarPreparationViewModel, SelectedTournamentsStore selectedTournamentsStore)
|
||||
{
|
||||
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentsStore);
|
||||
NavBarPreparationViewModel = navBarPreparationViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,10 +9,12 @@ namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public class ClassesViewModel : ViewModelBase
|
||||
{
|
||||
public TournamentDetailsViewModel TournamentDetailsViewModel { get; }
|
||||
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
|
||||
|
||||
public ClassesViewModel(NavBarPreparationViewModel navBarPreparationViewModel)
|
||||
public ClassesViewModel(NavBarPreparationViewModel navBarPreparationViewModel, SelectedTournamentsStore selectedTournamentsStore)
|
||||
{
|
||||
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentsStore);
|
||||
NavBarPreparationViewModel = navBarPreparationViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,13 @@ namespace Apollon.WPF.ViewModels
|
||||
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
|
||||
public ICommand NavigateOverviewCommand { get; }
|
||||
|
||||
public GroupsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
|
||||
public GroupsViewModel(NavBarPreparationViewModel navBarPreparationViewModel, SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore, NavigationService<GroupsViewModel> groupNavigationService)
|
||||
{
|
||||
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore);
|
||||
|
||||
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(new NavigationService<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore)));
|
||||
NavBarPreparationViewModel = navBarPreparationViewModel;
|
||||
|
||||
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(new NavigationService<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore, groupNavigationService)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public class NavBarPreparationViewModel : ViewModelBase
|
||||
{
|
||||
public ICommand NavigateOverviewCommand { get;}
|
||||
public ICommand NavigateOverviewCommand { get; }
|
||||
public ICommand NavigateGroupsCommand { get;}
|
||||
public ICommand NavigateClassesCommand { get;}
|
||||
public ICommand NavigateArchersCommand { get;}
|
||||
|
||||
@@ -30,14 +30,13 @@ namespace Apollon.WPF.ViewModels
|
||||
|
||||
public ICommand NavigatePreparationCommand { get; }
|
||||
|
||||
public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore)
|
||||
public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationService<GroupsViewModel> groupNavigationService)
|
||||
{
|
||||
_selectedTournamentStore = selectedTournamentStore;
|
||||
|
||||
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
|
||||
|
||||
NavigatePreparationCommand = new NavigateCommand<GroupsViewModel>(new NavigationService<GroupsViewModel> (
|
||||
navigationStore, () => new GroupsViewModel( _selectedTournamentStore, navigationStore, modalNavigationStore, tournamentsStore)));
|
||||
NavigatePreparationCommand = new NavigateCommand<GroupsViewModel>(groupNavigationService);
|
||||
}
|
||||
|
||||
protected override void Dispose()
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace Apollon.WPF.ViewModels
|
||||
public ICommand NavigateNameListCommand { get; }
|
||||
|
||||
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore,
|
||||
ModalNavigationStore modalNavigationStore, NavigationStore navigationStore)
|
||||
ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, NavigationService<GroupsViewModel> groupNavigationService)
|
||||
{
|
||||
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
|
||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,navigationStore, modalNavigationStore,tournamentStore);
|
||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,groupNavigationService);
|
||||
|
||||
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
||||
OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
|
||||
@@ -61,9 +61,10 @@ namespace Apollon.WPF.ViewModels
|
||||
public static OverviewViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore,
|
||||
ModalNavigationStore modalNavigationStore,
|
||||
TournamentsStore tournamentStore,
|
||||
NavigationStore navigationStore)
|
||||
NavigationStore navigationStore,
|
||||
NavigationService<GroupsViewModel> groupNavigationService)
|
||||
{
|
||||
OverviewViewModel viewModel = new OverviewViewModel(tournamentStore, selectedTournamentStore, modalNavigationStore, navigationStore);
|
||||
OverviewViewModel viewModel = new OverviewViewModel(tournamentStore, selectedTournamentStore, modalNavigationStore, navigationStore, groupNavigationService);
|
||||
|
||||
viewModel.LoadTournamentsCommand.Execute(null);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:components="clr-namespace:Apollon.WPF.Views.Components"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="680" d:DesignWidth="1100">
|
||||
<Grid Margin="1535">
|
||||
<Grid Margin="15, 35">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80"/>
|
||||
<RowDefinition Height="550"/>
|
||||
|
||||
Reference in New Issue
Block a user