From b40ef92e4b7f477ec860ea3cb7db5641e5643f30 Mon Sep 17 00:00:00 2001
From: Natlinux81 <97396587+Natlinux81@users.noreply.github.com>
Date: Thu, 18 Aug 2022 01:10:52 +0200
Subject: [PATCH] refill not works
---
Apollon.WPF/Apollon.WPF.csproj | 2 +-
.../Commands/OpenEditTournamentCommand.cs | 8 ++---
.../ViewModels/EditTournamentViewModel.cs | 14 ++-------
.../ViewModels/OverviewListingViewModel.cs | 29 +++++--------------
Apollon.WPF/ViewModels/OverviewViewModel.cs | 12 ++++++--
5 files changed, 25 insertions(+), 40 deletions(-)
diff --git a/Apollon.WPF/Apollon.WPF.csproj b/Apollon.WPF/Apollon.WPF.csproj
index 2f5c264..145af72 100644
--- a/Apollon.WPF/Apollon.WPF.csproj
+++ b/Apollon.WPF/Apollon.WPF.csproj
@@ -3,7 +3,7 @@
WinExe
net6.0-windows
- enable
+ disable
true
diff --git a/Apollon.WPF/Commands/OpenEditTournamentCommand.cs b/Apollon.WPF/Commands/OpenEditTournamentCommand.cs
index 6cd62b5..d136965 100644
--- a/Apollon.WPF/Commands/OpenEditTournamentCommand.cs
+++ b/Apollon.WPF/Commands/OpenEditTournamentCommand.cs
@@ -12,17 +12,17 @@ namespace Apollon.WPF.Commands
public class OpenEditTournamentCommand : CommandBase
{
private readonly ModalNavigationStore _modalNavigationStore;
- private readonly Tournament _tournament;
+
- public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore, Tournament tournament)
+ public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore)
{
_modalNavigationStore = modalNavigationStore;
- _tournament = tournament;
+
}
public override void Execute(object parameter)
{
- EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore, _tournament);
+ EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore);
_modalNavigationStore.CurrentViewModel = editTournamentViewModel;
}
}
diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs
index fa3d01f..fb86247 100644
--- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs
+++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs
@@ -14,20 +14,12 @@ namespace Apollon.WPF.ViewModels
{
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
- public EditTournamentViewModel(ModalNavigationStore modalNavigationStore, Tournament tournament)
+ public EditTournamentViewModel(ModalNavigationStore modalNavigationStore)
{
ICommand submitCommand = new EditTournamentCommand(modalNavigationStore);
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
- AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand )
- {
- Organisation = tournament.Organisation,
- TournamentName = tournament.TournamentName,
- Competition = tournament.Competition,
- StartDate = tournament.StartDate,
- EndDate = tournament.EndDate,
- Location = tournament.Location,
- Rounds = tournament.Rounds,
- };
+ AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand);
+
}
}
}
diff --git a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs
index 90b74f3..089ca5b 100644
--- a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs
+++ b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs
@@ -45,34 +45,19 @@ namespace Apollon.WPF.ViewModels
_modalNavigationStore = modalNavigationStore;
_overviewListingItemViewModels = new ObservableCollection();
- _tournamentStore.TournamentAdded += _tournamentStore_TournamentAdded;
+ //_overviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Meisterschaft", "Halle", DateTime.Now, DateTime.Now, "Bruchsal", 10)));
+
//AddTournament(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden",3),modalNavigationStore);
//AddTournament(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin",5),modalNavigationStore);
- //AddTournament(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal", 6),modalNavigationStore);
-
+ AddTournament(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", DateTime.Now, DateTime.Today, "Bruchsal", 6), modalNavigationStore);
+
}
- protected override void Dispose()
+ private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore)
{
- _tournamentStore.TournamentAdded -= _tournamentStore_TournamentAdded;
-
- base.Dispose();
- }
-
- private void _tournamentStore_TournamentAdded(Tournament tournament)
- {
- AddTournament(tournament);
- }
-
- private void AddTournament(Tournament tournament)
- {
- //ICommand editTournamentCommand = new OpenEditTournamentCommand(_modalNavigationStore);
- _overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament
- //,editTournamentCommand
- ));
+ // TO DO EditTournamentCommand
+ _overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament));
}
}
-
-
}
diff --git a/Apollon.WPF/ViewModels/OverviewViewModel.cs b/Apollon.WPF/ViewModels/OverviewViewModel.cs
index cd2b8f0..00ceba0 100644
--- a/Apollon.WPF/ViewModels/OverviewViewModel.cs
+++ b/Apollon.WPF/ViewModels/OverviewViewModel.cs
@@ -16,7 +16,7 @@ namespace Apollon.WPF.ViewModels
public OverviewDetailsViewModel OverviewDetailsViewModel{ get; }
public ICommand AddTournamentCommand { get; }
- public ICommand EditTournamentCommand { get; }
+ public ICommand EditTournamentCommand { get; set ; }
@@ -26,7 +26,15 @@ namespace Apollon.WPF.ViewModels
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore);
- //EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore);
+ EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore);
+
+ AddTournament(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", DateTime.Now, DateTime.Today, "Bruchsal", 6), modalNavigationStore);
+ }
+
+ private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore)
+ {
+ ICommand editTournamentCommand = new EditTournamentCommand(modalNavigationStore);
+
}
}
}