clean up Navgationservices Navbar
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using Apollon.Domain.Commands;
|
using Apollon.Domain.Commands;
|
||||||
using Apollon.Domain.Models;
|
|
||||||
using Apollon.Domain.Queries;
|
using Apollon.Domain.Queries;
|
||||||
using Apollon.EntityFramework;
|
using Apollon.EntityFramework;
|
||||||
using Apollon.EntityFramework.Commands;
|
using Apollon.EntityFramework.Commands;
|
||||||
@@ -8,19 +7,10 @@ using Apollon.WPF.Services;
|
|||||||
using Apollon.WPF.Stores;
|
using Apollon.WPF.Stores;
|
||||||
using Apollon.WPF.ViewModels;
|
using Apollon.WPF.ViewModels;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace Apollon.WPF
|
namespace Apollon.WPF
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for App.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private readonly NavigationStore _navigationStore;
|
private readonly NavigationStore _navigationStore;
|
||||||
@@ -65,19 +55,13 @@ namespace Apollon.WPF
|
|||||||
|
|
||||||
OverviewViewModel overviewViewModel = OverviewViewModel.LoadViewModel(
|
OverviewViewModel overviewViewModel = OverviewViewModel.LoadViewModel(
|
||||||
_selectedTournamentStore,
|
_selectedTournamentStore,
|
||||||
_modalNavigationStore,
|
_modalNavigationStore,
|
||||||
_tournamentStore,
|
_tournamentStore,
|
||||||
_navigationStore,
|
CreateGroupsNavigationService(),
|
||||||
CreateGroupsNavigationService());
|
CreateNamelistNavigationService());
|
||||||
|
|
||||||
_navigationStore.CurrentViewModel = OverviewViewModel.LoadViewModel(
|
NavigationService<OverviewViewModel> overvoewNavigationService = CreateOverviewNavigationService();
|
||||||
_selectedTournamentStore,
|
overvoewNavigationService.Navigate();
|
||||||
_modalNavigationStore,
|
|
||||||
_tournamentStore,
|
|
||||||
_navigationStore,
|
|
||||||
CreateGroupsNavigationService());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MainWindow = new MainWindow()
|
MainWindow = new MainWindow()
|
||||||
{
|
{
|
||||||
@@ -91,13 +75,13 @@ namespace Apollon.WPF
|
|||||||
private NavigationService<OverviewViewModel> CreateOverviewNavigationService()
|
private NavigationService<OverviewViewModel> CreateOverviewNavigationService()
|
||||||
{
|
{
|
||||||
return new NavigationService<OverviewViewModel>(
|
return new NavigationService<OverviewViewModel>(
|
||||||
_navigationStore, () => OverviewViewModel.LoadViewModel(_selectedTournamentStore, _modalNavigationStore, _tournamentStore, _navigationStore, CreateGroupsNavigationService()));
|
_navigationStore, () => OverviewViewModel.LoadViewModel(_selectedTournamentStore, _modalNavigationStore, _tournamentStore, CreateGroupsNavigationService(), CreateNamelistNavigationService()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private NavigationService<GroupsViewModel> CreateGroupsNavigationService()
|
private NavigationService<GroupsViewModel> CreateGroupsNavigationService()
|
||||||
{
|
{
|
||||||
return new NavigationService<GroupsViewModel>(
|
return new NavigationService<GroupsViewModel>(
|
||||||
_navigationStore, () => new GroupsViewModel( _navBarPreparationViewModel, _selectedTournamentStore, _navigationStore, _modalNavigationStore, _tournamentStore, CreateGroupsNavigationService()));
|
_navigationStore, () => new GroupsViewModel(_navBarPreparationViewModel, _selectedTournamentStore, CreateOverviewNavigationService()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private NavigationService<ClassesViewModel> CreateClassesNavigationService()
|
private NavigationService<ClassesViewModel> CreateClassesNavigationService()
|
||||||
|
|||||||
@@ -2,29 +2,22 @@
|
|||||||
using Apollon.WPF.Stores;
|
using Apollon.WPF.Stores;
|
||||||
using Apollon.WPF.ViewModels;
|
using Apollon.WPF.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Apollon.WPF.Commands
|
namespace Apollon.WPF.Commands
|
||||||
{
|
{
|
||||||
public class AddTournamentCommand : AsyncCommandBase
|
public class AddTournamentCommand : AsyncCommandBase
|
||||||
{
|
{
|
||||||
private readonly TournamentsStore _tournamentStore;
|
private readonly TournamentsStore _tournamentStore;
|
||||||
private readonly NavigationStore _navigationStore;
|
private readonly ModalNavigationStore _modalNavigationStore;
|
||||||
private readonly ModalNavigationStore _modalNavigationStore;
|
|
||||||
private readonly SelectedTournamentsStore _selectedTournamentsStore;
|
|
||||||
private AddTournamentViewModel _addTournamentViewModel;
|
private AddTournamentViewModel _addTournamentViewModel;
|
||||||
|
|
||||||
|
|
||||||
public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore)
|
public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
|
||||||
{
|
{
|
||||||
_addTournamentViewModel = addTournamentViewModel;
|
_addTournamentViewModel = addTournamentViewModel;
|
||||||
_tournamentStore = tournamentStore;
|
_tournamentStore = tournamentStore;
|
||||||
_modalNavigationStore = modalNavigationStore;
|
_modalNavigationStore = modalNavigationStore;
|
||||||
_navigationStore = navigationStore;
|
|
||||||
_selectedTournamentsStore = selectedTournamentsStore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ExecuteAsync(object parameter)
|
public override async Task ExecuteAsync(object parameter)
|
||||||
@@ -51,8 +44,7 @@ namespace Apollon.WPF.Commands
|
|||||||
{
|
{
|
||||||
await _tournamentStore.Add(tournament);
|
await _tournamentStore.Add(tournament);
|
||||||
|
|
||||||
_modalNavigationStore.Close();
|
_modalNavigationStore.Close();
|
||||||
//_navigationStore.CurrentViewModel = new GroupsViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|||||||
@@ -10,22 +10,19 @@ namespace Apollon.WPF.Commands
|
|||||||
{
|
{
|
||||||
public class OpenAddTournamentCommand : CommandBase
|
public class OpenAddTournamentCommand : CommandBase
|
||||||
{
|
{
|
||||||
private readonly TournamentsStore _tournamentStore;
|
private readonly TournamentsStore _tournamentStore;
|
||||||
private readonly SelectedTournamentsStore _selectedTournamentsStore;
|
|
||||||
private readonly NavigationStore _navigationStore;
|
|
||||||
private readonly ModalNavigationStore _modalNavigationStore;
|
private readonly ModalNavigationStore _modalNavigationStore;
|
||||||
|
|
||||||
public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore)
|
public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
|
||||||
{
|
{
|
||||||
_tournamentStore = tournamentStore;
|
_tournamentStore = tournamentStore;
|
||||||
_navigationStore = navigationStore;
|
|
||||||
_modalNavigationStore = modalNavigationStore;
|
_modalNavigationStore = modalNavigationStore;
|
||||||
_selectedTournamentsStore = selectedTournamentsStore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Execute(object parameter)
|
public override void Execute(object parameter)
|
||||||
{
|
{
|
||||||
AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationStore, _selectedTournamentsStore);
|
AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore);
|
||||||
_modalNavigationStore.CurrentViewModel = addTournamentViewModel;
|
_modalNavigationStore.CurrentViewModel = addTournamentViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
|
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
|
||||||
|
|
||||||
public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore,SelectedTournamentsStore selectedTournamentsStore)
|
public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
|
||||||
{
|
{
|
||||||
ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore,navigationStore, selectedTournamentsStore);
|
ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore);
|
||||||
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
|
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
|
||||||
AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand);
|
AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
|
public NavBarPreparationViewModel NavBarPreparationViewModel { get; }
|
||||||
public ICommand NavigateOverviewCommand { get; }
|
public ICommand NavigateOverviewCommand { get; }
|
||||||
|
|
||||||
public GroupsViewModel(NavBarPreparationViewModel navBarPreparationViewModel, SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore, NavigationService<GroupsViewModel> groupNavigationService)
|
public GroupsViewModel(NavBarPreparationViewModel navBarPreparationViewModel, SelectedTournamentsStore selectedTournamentStore, NavigationService<OverviewViewModel> overviewNavigationService)
|
||||||
{
|
{
|
||||||
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore);
|
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore);
|
||||||
|
|
||||||
NavBarPreparationViewModel = navBarPreparationViewModel;
|
NavBarPreparationViewModel = navBarPreparationViewModel;
|
||||||
|
|
||||||
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(new NavigationService<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore, groupNavigationService)));
|
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(overviewNavigationService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,25 +46,24 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public ICommand NavigateNameListCommand { get; }
|
public ICommand NavigateNameListCommand { get; }
|
||||||
|
|
||||||
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore,
|
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore,
|
||||||
ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, NavigationService<GroupsViewModel> groupNavigationService)
|
ModalNavigationStore modalNavigationStore, NavigationService<GroupsViewModel> groupNavigationService, NavigationService<NameListViewModel> NameListNavigationService)
|
||||||
{
|
{
|
||||||
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
|
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
|
||||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,groupNavigationService);
|
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,groupNavigationService);
|
||||||
|
|
||||||
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
||||||
OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
|
OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore);
|
||||||
NavigateNameListCommand = new NavigateCommand<NameListViewModel>(new NavigationService<NameListViewModel>(
|
NavigateNameListCommand = new NavigateCommand<NameListViewModel>(NameListNavigationService);
|
||||||
navigationStore, () => new NameListViewModel()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OverviewViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore,
|
public static OverviewViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore,
|
||||||
ModalNavigationStore modalNavigationStore,
|
ModalNavigationStore modalNavigationStore,
|
||||||
TournamentsStore tournamentStore,
|
TournamentsStore tournamentStore,
|
||||||
NavigationStore navigationStore,
|
NavigationService<GroupsViewModel> groupNavigationService,
|
||||||
NavigationService<GroupsViewModel> groupNavigationService)
|
NavigationService<NameListViewModel> NameListNavigationService)
|
||||||
{
|
{
|
||||||
OverviewViewModel viewModel = new OverviewViewModel(tournamentStore, selectedTournamentStore, modalNavigationStore, navigationStore, groupNavigationService);
|
OverviewViewModel viewModel = new OverviewViewModel(tournamentStore, selectedTournamentStore, modalNavigationStore,groupNavigationService, NameListNavigationService);
|
||||||
|
|
||||||
viewModel.LoadTournamentsCommand.Execute(null);
|
viewModel.LoadTournamentsCommand.Execute(null);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user