From d45c0cc1d57e06541f6b846a3b945d4f0d5caf4a Mon Sep 17 00:00:00 2001 From: Natlinux <97396587+Natlinux81@users.noreply.github.com> Date: Sun, 27 Nov 2022 15:18:07 +0100 Subject: [PATCH] try NavBar --- Apollon.WPF/Commands/AddTournamentCommand.cs | 4 +- Apollon.WPF/Commands/EditTournamentCommand.cs | 2 +- Apollon.WPF/MainWindow.xaml | 4 +- .../ViewModels/AddEditDetailsViewModel.cs | 4 +- .../ViewModels/EditTournamentViewModel.cs | 2 +- Apollon.WPF/ViewModels/GroupsViewModel.cs | 14 ++++++- ...Model.cs => NavBarPreparationViewModel.cs} | 2 +- .../ViewModels/OverviewDetailsViewModel.cs | 4 +- Apollon.WPF/ViewModels/OverviewViewModel.cs | 4 +- .../ViewModels/PreparationViewModel.cs | 28 ------------- ...lsView.xaml => NavBarPreparationView.xaml} | 23 ++++++++--- ....xaml.cs => NavBarPreparationView.xaml.cs} | 4 +- .../Views/Components/OverviewDetails.xaml | 2 +- Apollon.WPF/Views/GroupsView.xaml | 24 ++++++++++- Apollon.WPF/Views/OverviewView.xaml | 2 +- Apollon.WPF/Views/PreparationView.xaml | 40 ------------------- Apollon.WPF/Views/PreparationView.xaml.cs | 28 ------------- 17 files changed, 69 insertions(+), 122 deletions(-) rename Apollon.WPF/ViewModels/{NavBarTournamentDetailsViewModel.cs => NavBarPreparationViewModel.cs} (85%) delete mode 100644 Apollon.WPF/ViewModels/PreparationViewModel.cs rename Apollon.WPF/Views/Components/{NavBarTournamentDetailsView.xaml => NavBarPreparationView.xaml} (96%) rename Apollon.WPF/Views/Components/{NavBarTournamentDetailsView.xaml.cs => NavBarPreparationView.xaml.cs} (85%) delete mode 100644 Apollon.WPF/Views/PreparationView.xaml delete mode 100644 Apollon.WPF/Views/PreparationView.xaml.cs diff --git a/Apollon.WPF/Commands/AddTournamentCommand.cs b/Apollon.WPF/Commands/AddTournamentCommand.cs index c9b1b56..79e8de9 100644 --- a/Apollon.WPF/Commands/AddTournamentCommand.cs +++ b/Apollon.WPF/Commands/AddTournamentCommand.cs @@ -44,7 +44,7 @@ namespace Apollon.WPF.Commands detailsViewModel.StartDate, detailsViewModel.EndDate, detailsViewModel.Location, - detailsViewModel.Rounds, + detailsViewModel.Groups, detailsViewModel.Targets); try @@ -52,7 +52,7 @@ namespace Apollon.WPF.Commands await _tournamentStore.Add(tournament); _modalNavigationStore.Close(); - _navigationStore.CurrentViewModel = new PreparationViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore); + _navigationStore.CurrentViewModel = new GroupsViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore); } catch (Exception) diff --git a/Apollon.WPF/Commands/EditTournamentCommand.cs b/Apollon.WPF/Commands/EditTournamentCommand.cs index 26672c9..ba0d449 100644 --- a/Apollon.WPF/Commands/EditTournamentCommand.cs +++ b/Apollon.WPF/Commands/EditTournamentCommand.cs @@ -39,7 +39,7 @@ namespace Apollon.WPF.Commands detailsViewModel.StartDate, detailsViewModel.EndDate, detailsViewModel.Location, - detailsViewModel.Rounds, + detailsViewModel.Groups, detailsViewModel.Targets); try diff --git a/Apollon.WPF/MainWindow.xaml b/Apollon.WPF/MainWindow.xaml index fdb1bd7..1bc1bc0 100644 --- a/Apollon.WPF/MainWindow.xaml +++ b/Apollon.WPF/MainWindow.xaml @@ -46,8 +46,8 @@ - - + + diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index 2df4dca..ba7d166 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -135,7 +135,7 @@ namespace Apollon.WPF.ViewModels } private int _rounds; - public int Rounds + public int Groups { get { @@ -144,7 +144,7 @@ namespace Apollon.WPF.ViewModels set { _rounds = value; - OnPropertyChanged(nameof(Rounds)); + OnPropertyChanged(nameof(Groups)); } } diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs index 7c19040..2e54ddb 100644 --- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs +++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs @@ -32,7 +32,7 @@ namespace Apollon.WPF.ViewModels StartDate = tournament.StartDate, EndDate = tournament.EndDate, Location = tournament.Location, - Rounds = tournament.Rounds, + Groups = tournament.Rounds, Targets = tournament.Targets, }; diff --git a/Apollon.WPF/ViewModels/GroupsViewModel.cs b/Apollon.WPF/ViewModels/GroupsViewModel.cs index ee2094e..8bedc9e 100644 --- a/Apollon.WPF/ViewModels/GroupsViewModel.cs +++ b/Apollon.WPF/ViewModels/GroupsViewModel.cs @@ -1,12 +1,24 @@ -using System; +using Apollon.WPF.Commands; +using Apollon.WPF.Stores; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Input; namespace Apollon.WPF.ViewModels { public class GroupsViewModel : ViewModelBase { + public TournamentDetailsViewModel TournamentDetailsViewModel { get; } + public ICommand NavigateOverviewCommand { get; } + + public GroupsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore) + { + TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore); + + NavigateOverviewCommand = new NavigateCommand(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore)); + } } } diff --git a/Apollon.WPF/ViewModels/NavBarTournamentDetailsViewModel.cs b/Apollon.WPF/ViewModels/NavBarPreparationViewModel.cs similarity index 85% rename from Apollon.WPF/ViewModels/NavBarTournamentDetailsViewModel.cs rename to Apollon.WPF/ViewModels/NavBarPreparationViewModel.cs index 5ddadd7..1e0254d 100644 --- a/Apollon.WPF/ViewModels/NavBarTournamentDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/NavBarPreparationViewModel.cs @@ -8,7 +8,7 @@ using System.Windows.Input; namespace Apollon.WPF.ViewModels { - public class NavBarTournamentDetailsViewModel : ViewModelBase + public class NavBarPreparationViewModel : ViewModelBase { public ICommand NavigateArchersCommand { get;} public ICommand NavigateGroupsCommand { get;} diff --git a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs index 9e94e47..3dd5455 100644 --- a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs @@ -27,7 +27,7 @@ namespace Apollon.WPF.ViewModels public int Rounds => SelectedTournament?.Rounds ?? 0; public int Targets => SelectedTournament?.Targets ?? 0; - public ICommand NavigateTournamentDetailsCommand { get; } + public ICommand NavigatePreparationCommand { get; } public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore) { @@ -35,7 +35,7 @@ namespace Apollon.WPF.ViewModels _selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged; - NavigateTournamentDetailsCommand = new NavigateCommand(navigationStore, () => new PreparationViewModel(_selectedTournamentStore,navigationStore, modalNavigationStore, tournamentsStore)); + NavigatePreparationCommand = new NavigateCommand(navigationStore, () => new GroupsViewModel(selectedTournamentStore, navigationStore, modalNavigationStore, tournamentsStore)); } protected override void Dispose() diff --git a/Apollon.WPF/ViewModels/OverviewViewModel.cs b/Apollon.WPF/ViewModels/OverviewViewModel.cs index 7374a5e..5006320 100644 --- a/Apollon.WPF/ViewModels/OverviewViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewViewModel.cs @@ -46,7 +46,7 @@ namespace Apollon.WPF.ViewModels public bool HasErrorMessage => !string.IsNullOrEmpty(ErrorMessage); - public ICommand AddTournamentCommand { get; } + public ICommand OpenAddTournamentCommand { get; } public ICommand LoadTournamentsCommand { get; } public ICommand NavigateNameListCommand { get; } @@ -57,7 +57,7 @@ namespace Apollon.WPF.ViewModels OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,navigationStore, modalNavigationStore,tournamentStore); LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore); - AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore); + OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore); NavigateNameListCommand = new NavigateCommand(navigationStore, () => new NameListViewModel()); } diff --git a/Apollon.WPF/ViewModels/PreparationViewModel.cs b/Apollon.WPF/ViewModels/PreparationViewModel.cs deleted file mode 100644 index 5a9ac41..0000000 --- a/Apollon.WPF/ViewModels/PreparationViewModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Apollon.Domain.Models; -using Apollon.WPF.Commands; -using Apollon.WPF.Stores; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Input; - -namespace Apollon.WPF.ViewModels -{ - public class PreparationViewModel : ViewModelBase - - { - public TournamentDetailsViewModel TournamentDetailsViewModel { get; } - - public ICommand NavigateOverviewCommand { get; } - - public PreparationViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore) - { - TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore); - - NavigateOverviewCommand = new NavigateCommand(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore)); - } - - } -} diff --git a/Apollon.WPF/Views/Components/NavBarTournamentDetailsView.xaml b/Apollon.WPF/Views/Components/NavBarPreparationView.xaml similarity index 96% rename from Apollon.WPF/Views/Components/NavBarTournamentDetailsView.xaml rename to Apollon.WPF/Views/Components/NavBarPreparationView.xaml index 6c41de3..88dc0e3 100644 --- a/Apollon.WPF/Views/Components/NavBarTournamentDetailsView.xaml +++ b/Apollon.WPF/Views/Components/NavBarPreparationView.xaml @@ -1,4 +1,4 @@ - - + + + @@ -65,7 +76,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center"/> - + @@ -76,7 +87,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center"/> - + - - + + diff --git a/Apollon.WPF/Views/Components/NavBarTournamentDetailsView.xaml.cs b/Apollon.WPF/Views/Components/NavBarPreparationView.xaml.cs similarity index 85% rename from Apollon.WPF/Views/Components/NavBarTournamentDetailsView.xaml.cs rename to Apollon.WPF/Views/Components/NavBarPreparationView.xaml.cs index f975869..9e40269 100644 --- a/Apollon.WPF/Views/Components/NavBarTournamentDetailsView.xaml.cs +++ b/Apollon.WPF/Views/Components/NavBarPreparationView.xaml.cs @@ -18,9 +18,9 @@ namespace Apollon.WPF.Views.Components /// /// Interaction logic for NavBarView.xaml /// - public partial class NavBarView : UserControl + public partial class NavBarPreparationView : UserControl { - public NavBarView() + public NavBarPreparationView() { InitializeComponent(); } diff --git a/Apollon.WPF/Views/Components/OverviewDetails.xaml b/Apollon.WPF/Views/Components/OverviewDetails.xaml index f9cfa6b..4419b1c 100644 --- a/Apollon.WPF/Views/Components/OverviewDetails.xaml +++ b/Apollon.WPF/Views/Components/OverviewDetails.xaml @@ -289,7 +289,7 @@ Width="150" Margin="10" Cursor="Hand" - Command="{Binding NavigateTournamentDetailsCommand}"> + Command="{Binding NavigatePreparationCommand}">