From 7911aa46ded3478929b9d34909636486fa690d94 Mon Sep 17 00:00:00 2001 From: Natlinux <97396587+Natlinux81@users.noreply.github.com> Date: Wed, 8 Feb 2023 20:15:55 +0100 Subject: [PATCH] next Try implement Layout --- Apollon.WPF/Commands/AddTournamentCommand.cs | 9 ++++-- .../Commands/OpenAddTournamentCommand.cs | 12 ++++---- Apollon.WPF/MainWindow.xaml | 12 ++++++-- .../ViewModels/AddTournametViewModel.cs | 5 ++-- Apollon.WPF/ViewModels/OverviewViewModel.cs | 2 +- Apollon.WPF/Views/Layout.xaml | 22 --------------- Apollon.WPF/Views/Layout.xaml.cs | 28 ------------------- 7 files changed, 27 insertions(+), 63 deletions(-) delete mode 100644 Apollon.WPF/Views/Layout.xaml delete mode 100644 Apollon.WPF/Views/Layout.xaml.cs diff --git a/Apollon.WPF/Commands/AddTournamentCommand.cs b/Apollon.WPF/Commands/AddTournamentCommand.cs index 20bb23d..d705f58 100644 --- a/Apollon.WPF/Commands/AddTournamentCommand.cs +++ b/Apollon.WPF/Commands/AddTournamentCommand.cs @@ -1,4 +1,5 @@ using Apollon.Domain.Models; +using Apollon.WPF.Services; using Apollon.WPF.Stores; using Apollon.WPF.ViewModels; using System; @@ -11,13 +12,15 @@ namespace Apollon.WPF.Commands private readonly TournamentsStore _tournamentStore; private readonly ModalNavigationStore _modalNavigationStore; private AddTournamentViewModel _addTournamentViewModel; + private readonly NavigationService _navigationService; - public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore) + public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationService navigationService) { _addTournamentViewModel = addTournamentViewModel; _tournamentStore = tournamentStore; - _modalNavigationStore = modalNavigationStore; + _modalNavigationStore = modalNavigationStore; + _navigationService = navigationService; } public override async Task ExecuteAsync(object parameter) @@ -45,7 +48,7 @@ namespace Apollon.WPF.Commands await _tournamentStore.Add(tournament); _modalNavigationStore.Close(); - + _navigationService.Navigate(); } catch (Exception) { diff --git a/Apollon.WPF/Commands/OpenAddTournamentCommand.cs b/Apollon.WPF/Commands/OpenAddTournamentCommand.cs index 00dce61..21b9ab9 100644 --- a/Apollon.WPF/Commands/OpenAddTournamentCommand.cs +++ b/Apollon.WPF/Commands/OpenAddTournamentCommand.cs @@ -1,4 +1,5 @@ -using Apollon.WPF.Stores; +using Apollon.WPF.Services; +using Apollon.WPF.Stores; using Apollon.WPF.ViewModels; using System; using System.Collections.Generic; @@ -12,17 +13,18 @@ namespace Apollon.WPF.Commands { private readonly TournamentsStore _tournamentStore; private readonly ModalNavigationStore _modalNavigationStore; + private readonly NavigationService _navigationService; - public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore) + public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationService navigationService) { - _tournamentStore = tournamentStore; + _tournamentStore = tournamentStore; _modalNavigationStore = modalNavigationStore; - + _navigationService = navigationService; } public override void Execute(object parameter) { - AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore); + AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationService); _modalNavigationStore.CurrentViewModel = addTournamentViewModel; } } diff --git a/Apollon.WPF/MainWindow.xaml b/Apollon.WPF/MainWindow.xaml index c00c74e..ba11e1c 100644 --- a/Apollon.WPF/MainWindow.xaml +++ b/Apollon.WPF/MainWindow.xaml @@ -38,8 +38,16 @@ - - + + + + + + + + + diff --git a/Apollon.WPF/ViewModels/AddTournametViewModel.cs b/Apollon.WPF/ViewModels/AddTournametViewModel.cs index 253f83e..1a6798d 100644 --- a/Apollon.WPF/ViewModels/AddTournametViewModel.cs +++ b/Apollon.WPF/ViewModels/AddTournametViewModel.cs @@ -1,4 +1,5 @@ using Apollon.WPF.Commands; +using Apollon.WPF.Services; using Apollon.WPF.Stores; using System; using System.Collections.Generic; @@ -13,9 +14,9 @@ namespace Apollon.WPF.ViewModels { public AddEditDetailsViewModel AddEditDetailsViewModel { get; } - public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore) + public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationService navigationService) { - ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore); + ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore, navigationService); ICommand cancelCommand = new CloseModalCommand(modalNavigationStore); AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand); } diff --git a/Apollon.WPF/ViewModels/OverviewViewModel.cs b/Apollon.WPF/ViewModels/OverviewViewModel.cs index 44dff04..58e6dca 100644 --- a/Apollon.WPF/ViewModels/OverviewViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewViewModel.cs @@ -52,7 +52,7 @@ namespace Apollon.WPF.ViewModels OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,groupNavigationService); LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore); - OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore); + OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, groupNavigationService); NavigateNameListCommand = new NavigateCommand(NameListNavigationService); } diff --git a/Apollon.WPF/Views/Layout.xaml b/Apollon.WPF/Views/Layout.xaml deleted file mode 100644 index 09fa902..0000000 --- a/Apollon.WPF/Views/Layout.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - diff --git a/Apollon.WPF/Views/Layout.xaml.cs b/Apollon.WPF/Views/Layout.xaml.cs deleted file mode 100644 index 0b62aa7..0000000 --- a/Apollon.WPF/Views/Layout.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Apollon.WPF.Views -{ - /// - /// Interaction logic for Layout.xaml - /// - public partial class Layout : UserControl - { - public Layout() - { - InitializeComponent(); - } - } -}