diff --git a/Apollon.WPF/Commands/AddTournamentCommand.cs b/Apollon.WPF/Commands/AddTournamentCommand.cs index 747def6..d8025a2 100644 --- a/Apollon.WPF/Commands/AddTournamentCommand.cs +++ b/Apollon.WPF/Commands/AddTournamentCommand.cs @@ -14,14 +14,17 @@ namespace Apollon.WPF.Commands private readonly TournamentsStore _tournamentStore; private readonly NavigationStore _navigationStore; private readonly ModalNavigationStore _modalNavigationStore; + private readonly SelectedTournamentsStore _selectedTournamentsStore; private AddTournamentViewModel _addTournamentViewModel; - public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore) + + public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore) { _addTournamentViewModel = addTournamentViewModel; _tournamentStore = tournamentStore; _modalNavigationStore = modalNavigationStore; _navigationStore = navigationStore; + _selectedTournamentsStore = selectedTournamentsStore; } public override async Task ExecuteAsync(object parameter) @@ -47,7 +50,7 @@ namespace Apollon.WPF.Commands await _tournamentStore.Add(tournament); _modalNavigationStore.Close(); - _navigationStore.CurrentViewModel = new NavBarViewModel(_navigationStore); + //_navigationStore.CurrentViewModel = new NavBarViewModel(_navigationStore, _selectedTournamentsStore, _modalNavigationStore,_tournamentStore); } catch (Exception) diff --git a/Apollon.WPF/Commands/OpenAddTournamentCommand.cs b/Apollon.WPF/Commands/OpenAddTournamentCommand.cs index 2502bd2..84a1701 100644 --- a/Apollon.WPF/Commands/OpenAddTournamentCommand.cs +++ b/Apollon.WPF/Commands/OpenAddTournamentCommand.cs @@ -11,19 +11,21 @@ namespace Apollon.WPF.Commands public class OpenAddTournamentCommand : CommandBase { private readonly TournamentsStore _tournamentStore; + private readonly SelectedTournamentsStore _selectedTournamentsStore; private readonly NavigationStore _navigationStore; private readonly ModalNavigationStore _modalNavigationStore; - public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore) + public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore) { _tournamentStore = tournamentStore; _navigationStore = navigationStore; _modalNavigationStore = modalNavigationStore; + _selectedTournamentsStore = selectedTournamentsStore; } public override void Execute(object parameter) { - AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationStore); + AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationStore, _selectedTournamentsStore); _modalNavigationStore.CurrentViewModel = addTournamentViewModel; } } diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index 7f5ea6c..f551018 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using System.Windows.Input; namespace Apollon.WPF.ViewModels @@ -56,13 +57,13 @@ namespace Apollon.WPF.ViewModels public string CompetitionImage { get - { + { return _competitionImage; } set { _competitionImage = value; - OnPropertyChanged(nameof(CompetitionImage)); + OnPropertyChanged(nameof(CompetitionImage));; } } diff --git a/Apollon.WPF/ViewModels/AddTournametViewModel.cs b/Apollon.WPF/ViewModels/AddTournametViewModel.cs index c9480c8..1020230 100644 --- a/Apollon.WPF/ViewModels/AddTournametViewModel.cs +++ b/Apollon.WPF/ViewModels/AddTournametViewModel.cs @@ -13,9 +13,9 @@ namespace Apollon.WPF.ViewModels { public AddEditDetailsViewModel AddEditDetailsViewModel { get; } - public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore) + public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore,SelectedTournamentsStore selectedTournamentsStore) { - ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore,navigationStore); + ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore,navigationStore, selectedTournamentsStore); ICommand cancelCommand = new CloseModalCommand(modalNavigationStore); AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand); } diff --git a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs index 0323660..cdcd058 100644 --- a/Apollon.WPF/ViewModels/EditTournamentViewModel.cs +++ b/Apollon.WPF/ViewModels/EditTournamentViewModel.cs @@ -26,7 +26,8 @@ namespace Apollon.WPF.ViewModels { Organisation = tournament.Organisation, TournamentName = tournament.TournamentName, - Competition = tournament.Competition, + Competition = tournament.Competition, + CompetitionImage = tournament.CompetitionImage, StartDate = tournament.StartDate, EndDate = tournament.EndDate, Location = tournament.Location, diff --git a/Apollon.WPF/ViewModels/NavBarViewModel.cs b/Apollon.WPF/ViewModels/NavBarViewModel.cs index 6083b4e..46499fa 100644 --- a/Apollon.WPF/ViewModels/NavBarViewModel.cs +++ b/Apollon.WPF/ViewModels/NavBarViewModel.cs @@ -1,16 +1,23 @@ -using Apollon.WPF.Stores; +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 NavBarViewModel : ViewModelBase + { - public NavBarViewModel(NavigationStore navigationStore) + + public ICommand NavigateOverviewCommand { get; } + public NavBarViewModel(NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore) { + NavigateOverviewCommand = new NavigateCommand(navigationStore, () => new OverviewViewModel(tournamentsStore, selectedTournamentsStore, modalNavigationStore,navigationStore)); + } } } diff --git a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs index 05e19d6..2b942a0 100644 --- a/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewDetailsViewModel.cs @@ -17,7 +17,7 @@ namespace Apollon.WPF.ViewModels public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation"; public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name"; public string Competition => SelectedTournament?.Competition ?? "keine Kategorie"; - public string CompetitionImage => SelectedTournament?.CompetitionImage ?? "kein Bild"; + public string CompetitionImage => SelectedTournament?.CompetitionImage ?? "D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\Archery.png"; public string StartDate => SelectedTournament?.StartDate.ToString("d") ?? "kein Datum"; public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum"; public string Location => SelectedTournament?.Location ?? "kein Ort"; diff --git a/Apollon.WPF/ViewModels/OverviewViewModel.cs b/Apollon.WPF/ViewModels/OverviewViewModel.cs index 4234f92..f573f34 100644 --- a/Apollon.WPF/ViewModels/OverviewViewModel.cs +++ b/Apollon.WPF/ViewModels/OverviewViewModel.cs @@ -57,8 +57,8 @@ namespace Apollon.WPF.ViewModels OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore); LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore); - AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore); - NavigateNavBarCommand = new NavigateCommand(navigationStore, () => new NavBarViewModel(navigationStore)); + AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore); + NavigateNavBarCommand = new NavigateCommand(navigationStore, () => new NavBarViewModel(navigationStore,selectedTournamentStore,modalNavigationStore,tournamentStore)); } diff --git a/Apollon.WPF/Views/Components/AddEditDetails.xaml b/Apollon.WPF/Views/Components/AddEditDetails.xaml index af9d9c0..7f4e776 100644 --- a/Apollon.WPF/Views/Components/AddEditDetails.xaml +++ b/Apollon.WPF/Views/Components/AddEditDetails.xaml @@ -7,7 +7,7 @@ xmlns:custom="clr-namespace:LoadingSpinnerControl;assembly=LoadingSpinnerControl" mc:Ignorable="d"> - + @@ -76,24 +76,23 @@ IsEditable="True" Grid.Column="1" Height="30" - Width="150" + Width="200" FontSize="16" VerticalContentAlignment="Center" - HorizontalAlignment="Left"> - - - - + HorizontalAlignment="Left" + Loaded="ComboBox_Loaded" + SelectionChanged="ComboBox_SelectionChanged"> - + Margin="0 0 80 0" + Source="{Binding CompetitionImage, Mode=TwoWay, TargetNullValue={x:Null}}" /> competitions = new List() + { + "Halle", "im Freien", "Feld", "3D" + }; + ComboBox.ItemsSource = competitions; + } + + private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + if (ComboBox.SelectedIndex == 0) + { + CompetitionImage.Source = new BitmapImage(new Uri(@"D:\Projekte\Apollon\Apollon\Apollon.WPF\Images\TargetHall.png")); + } + if (ComboBox.SelectedIndex == 1) + { + CompetitionImage.Source = new BitmapImage(new Uri("D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\TargetField.png")); + } + if (ComboBox.SelectedIndex == 2) + { + CompetitionImage.Source = new BitmapImage(new Uri("D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\TargetOutdoor.png")); + } + + } - } } + } + diff --git a/Apollon.WPF/Views/Components/OverviewDetails.xaml b/Apollon.WPF/Views/Components/OverviewDetails.xaml index 3d9380a..59ede64 100644 --- a/Apollon.WPF/Views/Components/OverviewDetails.xaml +++ b/Apollon.WPF/Views/Components/OverviewDetails.xaml @@ -4,8 +4,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Apollon.WPF.Views.Components" + xmlns:converter="clr-namespace:Apollon.WPF.Views.Components" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800"> + d:DesignHeight="450" d:DesignWidth="800"> + Height="50"> - + + + diff --git a/Apollon.WPF/Views/NavBarView.xaml b/Apollon.WPF/Views/NavBarView.xaml index da29c0d..b64fd40 100644 --- a/Apollon.WPF/Views/NavBarView.xaml +++ b/Apollon.WPF/Views/NavBarView.xaml @@ -23,7 +23,8 @@ Background="Transparent" BorderThickness="0" HorizontalAlignment="Left" - Margin="5"> + Margin="5" + Command="{Binding NavigateOverviewCommand}">