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