From a69468518150fa79c32c86835b6afaf181ce58cd Mon Sep 17 00:00:00 2001 From: Natlinux81 <97396587+Natlinux81@users.noreply.github.com> Date: Sun, 14 Aug 2022 17:37:41 +0200 Subject: [PATCH] implement Rounds --- Apollon.WPF/Models/Tournament.cs | 7 ++-- .../ViewModels/AddEditDetailsViewModel.cs | 14 +++++++ .../ViewModels/OverviewDetailsViewModel.cs | 2 + .../ViewModels/OverviewListingViewModel.cs | 6 +-- .../Views/Components/AddEditDetails.xaml | 18 ++++++++- .../Views/Components/OverviewDetails.xaml | 38 ++++++++++++++++++- 6 files changed, 76 insertions(+), 9 deletions(-) diff --git a/Apollon.WPF/Models/Tournament.cs b/Apollon.WPF/Models/Tournament.cs index e6f0a2a..7613d49 100644 --- a/Apollon.WPF/Models/Tournament.cs +++ b/Apollon.WPF/Models/Tournament.cs @@ -8,7 +8,7 @@ namespace Apollon.WPF.Models { public class Tournament { - public Tournament(string organisation, string tournamentname, string category, string startdate, string enddate, string location) + public Tournament(string organisation, string tournamentname, string category, string startdate, string enddate, string location, int rounds = 0) { Organisation = organisation; Tournamentname = tournamentname; @@ -16,8 +16,8 @@ namespace Apollon.WPF.Models Startdate = startdate; Enddate = enddate; Location = location; - - } + Rounds = rounds; + } public string Organisation { get; } public string Tournamentname { get; } @@ -25,6 +25,7 @@ namespace Apollon.WPF.Models public string Startdate { get; } public string Enddate { get; } public string Location { get; } + public int Rounds { get; } } } diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index 0ccd17d..bdce062 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -80,6 +80,20 @@ namespace Apollon.WPF.ViewModels } } + private int _rounds; + public int Rounds + { + get + { + return _rounds; + } + set + { + _rounds = value; + OnPropertyChanged(nameof(Rounds)); + } + } + private string _location; public string Location { diff --git a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs index 6098506..3d1dafa 100644 --- a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs @@ -21,6 +21,7 @@ namespace Apollon.WPF.ViewModels public string Startdate => SelectedTournament?.Startdate ?? "kein Datum"; public string Enddate => SelectedTournament?.Enddate ?? "kein Datum"; public string Location => SelectedTournament?.Location ?? "kein Ort"; + public int Rounds => SelectedTournament?.Rounds ?? 0; public OverviewDetailsViewModel(SelectedTournamentStore selectedTournamentStore) { @@ -44,6 +45,7 @@ namespace Apollon.WPF.ViewModels OnPropertyChanged(nameof(Startdate)); OnPropertyChanged(nameof(Enddate)); OnPropertyChanged(nameof(Location)); + OnPropertyChanged(nameof(Rounds)); } } } diff --git a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs index 23453e0..dbe6245 100644 --- a/Apollon.WPF/ViewModels/OverviewListingViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewListingViewModel.cs @@ -39,9 +39,9 @@ namespace Apollon.WPF.ViewModels _selectedTournamentStore = selectedTournamentStore; _apollonOverviewListingItemViewModels = new ObservableCollection(); - _apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden"))); - _apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin"))); - _apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal"))); + _apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden",3))); + _apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin",5))); + _apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal", 6))); } } diff --git a/Apollon.WPF/Views/Components/AddEditDetails.xaml b/Apollon.WPF/Views/Components/AddEditDetails.xaml index 1d47a5a..5cbcc4f 100644 --- a/Apollon.WPF/Views/Components/AddEditDetails.xaml +++ b/Apollon.WPF/Views/Components/AddEditDetails.xaml @@ -13,6 +13,7 @@ + @@ -37,8 +38,11 @@ + - + - - + + + + + + + + + + + + +