From cc060b273ad75b5470ed0f3a6367270f90dd2263 Mon Sep 17 00:00:00 2001 From: Natlinux81 <97396587+Natlinux81@users.noreply.github.com> Date: Tue, 16 Aug 2022 02:52:01 +0200 Subject: [PATCH] Edit Modal not Works --- Apollon.WPF/App.xaml.cs | 2 +- .../Commands/OpenEditTournamentCommand.cs | 10 ++++++---- .../ViewModels/EditTournamentViewModel.cs | 16 ++++++++-------- .../ViewModels/OverviewListingViewModel.cs | 5 ++++- Apollon.WPF/ViewModels/OverviewViewModel.cs | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Apollon.WPF/App.xaml.cs b/Apollon.WPF/App.xaml.cs index 05a7a3e..9cf1f76 100644 --- a/Apollon.WPF/App.xaml.cs +++ b/Apollon.WPF/App.xaml.cs @@ -18,7 +18,7 @@ namespace Apollon.WPF { private readonly ModalNavigationStore _modalNavigationStore; private readonly SelectedTournamentStore _selectedTournamentStore; - //private readonly Tournament _tournament; + public App() { diff --git a/Apollon.WPF/Commands/OpenEditTournamentCommand.cs b/Apollon.WPF/Commands/OpenEditTournamentCommand.cs index d61bd68..6cd62b5 100644 --- a/Apollon.WPF/Commands/OpenEditTournamentCommand.cs +++ b/Apollon.WPF/Commands/OpenEditTournamentCommand.cs @@ -11,16 +11,18 @@ namespace Apollon.WPF.Commands { public class OpenEditTournamentCommand : CommandBase { - private readonly ModalNavigationStore _modalNavigationStore; + private readonly ModalNavigationStore _modalNavigationStore; + private readonly Tournament _tournament; - public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore) + public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore, Tournament tournament) { - _modalNavigationStore = modalNavigationStore; + _modalNavigationStore = modalNavigationStore; + _tournament = tournament; } public override void Execute(object parameter) { - EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore); + EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore, _tournament); _modalNavigationStore.CurrentViewModel = editTournamentViewModel; } } diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs index 296d033..4176e35 100644 --- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs +++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs @@ -14,19 +14,19 @@ namespace Apollon.WPF.ViewModels { public AddEditDetailsViewModel AddEditDetailsViewModel { get; } - public EditTournamentViewModel(ModalNavigationStore modalNavigationStore) + public EditTournamentViewModel(ModalNavigationStore modalNavigationStore, Tournament tournament) { ICommand submitCommand = new EditTournamentCommand(modalNavigationStore); ICommand cancelCommand = new CloseModalCommand(modalNavigationStore); AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand ) { - //Organisation = tournament.Organisation, - //Tournamentname = tournament.Tournamentname, - //Category = tournament.Category, - //Startdate = tournament.Startdate, - //Enddate = tournament.Enddate, - //Location = tournament.Location, - //Rounds = tournament.Rounds, + Organisation = tournament.Organisation, + Tournamentname = tournament.Tournamentname, + Category = tournament.Category, + Startdate = tournament.Startdate, + Enddate = tournament.Enddate, + Location = tournament.Location, + Rounds = tournament.Rounds, }; } } diff --git a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs index 75d8fc3..b5c4f51 100644 --- a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs @@ -48,7 +48,10 @@ namespace Apollon.WPF.ViewModels } private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore) { - _overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament)); + ICommand editTournamentCommand = new OpenAddTournamentCommand(modalNavigationStore); + _overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament + //,editTournamentCommand + )); } } diff --git a/Apollon.WPF/ViewModels/OverviewViewModel.cs b/Apollon.WPF/ViewModels/OverviewViewModel.cs index 3c849e6..853ce61 100644 --- a/Apollon.WPF/ViewModels/OverviewViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewViewModel.cs @@ -26,7 +26,7 @@ namespace Apollon.WPF.ViewModels OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore); AddTournamentCommand = new OpenAddTournamentCommand(modalNavigationStore); - EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore); + //EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore); } } }