finish addedit
This commit is contained in:
@@ -14,14 +14,17 @@ namespace Apollon.WPF.Commands
|
|||||||
private readonly TournamentsStore _tournamentStore;
|
private readonly TournamentsStore _tournamentStore;
|
||||||
private readonly NavigationStore _navigationStore;
|
private readonly NavigationStore _navigationStore;
|
||||||
private readonly ModalNavigationStore _modalNavigationStore;
|
private readonly ModalNavigationStore _modalNavigationStore;
|
||||||
|
private readonly SelectedTournamentsStore _selectedTournamentsStore;
|
||||||
private AddTournamentViewModel _addTournamentViewModel;
|
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;
|
_addTournamentViewModel = addTournamentViewModel;
|
||||||
_tournamentStore = tournamentStore;
|
_tournamentStore = tournamentStore;
|
||||||
_modalNavigationStore = modalNavigationStore;
|
_modalNavigationStore = modalNavigationStore;
|
||||||
_navigationStore = navigationStore;
|
_navigationStore = navigationStore;
|
||||||
|
_selectedTournamentsStore = selectedTournamentsStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ExecuteAsync(object parameter)
|
public override async Task ExecuteAsync(object parameter)
|
||||||
@@ -47,7 +50,7 @@ namespace Apollon.WPF.Commands
|
|||||||
await _tournamentStore.Add(tournament);
|
await _tournamentStore.Add(tournament);
|
||||||
|
|
||||||
_modalNavigationStore.Close();
|
_modalNavigationStore.Close();
|
||||||
_navigationStore.CurrentViewModel = new NavBarViewModel(_navigationStore);
|
//_navigationStore.CurrentViewModel = new NavBarViewModel(_navigationStore, _selectedTournamentsStore, _modalNavigationStore,_tournamentStore);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|||||||
@@ -11,19 +11,21 @@ namespace Apollon.WPF.Commands
|
|||||||
public class OpenAddTournamentCommand : CommandBase
|
public class OpenAddTournamentCommand : CommandBase
|
||||||
{
|
{
|
||||||
private readonly TournamentsStore _tournamentStore;
|
private readonly TournamentsStore _tournamentStore;
|
||||||
|
private readonly SelectedTournamentsStore _selectedTournamentsStore;
|
||||||
private readonly NavigationStore _navigationStore;
|
private readonly NavigationStore _navigationStore;
|
||||||
private readonly ModalNavigationStore _modalNavigationStore;
|
private readonly ModalNavigationStore _modalNavigationStore;
|
||||||
|
|
||||||
public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore)
|
public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore)
|
||||||
{
|
{
|
||||||
_tournamentStore = tournamentStore;
|
_tournamentStore = tournamentStore;
|
||||||
_navigationStore = navigationStore;
|
_navigationStore = navigationStore;
|
||||||
_modalNavigationStore = modalNavigationStore;
|
_modalNavigationStore = modalNavigationStore;
|
||||||
|
_selectedTournamentsStore = selectedTournamentsStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Execute(object parameter)
|
public override void Execute(object parameter)
|
||||||
{
|
{
|
||||||
AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationStore);
|
AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationStore, _selectedTournamentsStore);
|
||||||
_modalNavigationStore.CurrentViewModel = addTournamentViewModel;
|
_modalNavigationStore.CurrentViewModel = addTournamentViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Apollon.WPF.ViewModels
|
namespace Apollon.WPF.ViewModels
|
||||||
@@ -62,7 +63,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_competitionImage = value;
|
_competitionImage = value;
|
||||||
OnPropertyChanged(nameof(CompetitionImage));
|
OnPropertyChanged(nameof(CompetitionImage));;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
|
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);
|
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
|
||||||
AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand);
|
AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
Organisation = tournament.Organisation,
|
Organisation = tournament.Organisation,
|
||||||
TournamentName = tournament.TournamentName,
|
TournamentName = tournament.TournamentName,
|
||||||
Competition = tournament.Competition,
|
Competition = tournament.Competition,
|
||||||
|
CompetitionImage = tournament.CompetitionImage,
|
||||||
StartDate = tournament.StartDate,
|
StartDate = tournament.StartDate,
|
||||||
EndDate = tournament.EndDate,
|
EndDate = tournament.EndDate,
|
||||||
Location = tournament.Location,
|
Location = tournament.Location,
|
||||||
|
|||||||
@@ -1,16 +1,23 @@
|
|||||||
using Apollon.WPF.Stores;
|
using Apollon.WPF.Commands;
|
||||||
|
using Apollon.WPF.Stores;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Apollon.WPF.ViewModels
|
namespace Apollon.WPF.ViewModels
|
||||||
{
|
{
|
||||||
public class NavBarViewModel : ViewModelBase
|
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<OverviewViewModel>(navigationStore, () => new OverviewViewModel(tournamentsStore, selectedTournamentsStore, modalNavigationStore,navigationStore));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation";
|
public string Organisation => SelectedTournament?.Organisation ?? "keine Organisation";
|
||||||
public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name";
|
public string TournamentName => SelectedTournament?.TournamentName ?? "kein Name";
|
||||||
public string Competition => SelectedTournament?.Competition ?? "keine Kategorie";
|
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 StartDate => SelectedTournament?.StartDate.ToString("d") ?? "kein Datum";
|
||||||
public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum";
|
public string EndDate => SelectedTournament?.EndDate.ToString("d") ?? "kein Datum";
|
||||||
public string Location => SelectedTournament?.Location ?? "kein Ort";
|
public string Location => SelectedTournament?.Location ?? "kein Ort";
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ namespace Apollon.WPF.ViewModels
|
|||||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
|
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
|
||||||
|
|
||||||
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
||||||
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore);
|
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
|
||||||
NavigateNavBarCommand = new NavigateCommand<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore));
|
NavigateNavBarCommand = new NavigateCommand<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore,selectedTournamentStore,modalNavigationStore,tournamentStore));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,24 +76,23 @@
|
|||||||
IsEditable="True"
|
IsEditable="True"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Height="30"
|
Height="30"
|
||||||
Width="150"
|
Width="200"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left"
|
||||||
<ComboBoxItem Content="Halle"></ComboBoxItem>
|
Loaded="ComboBox_Loaded"
|
||||||
<ComboBoxItem Content="im Freien"></ComboBoxItem>
|
SelectionChanged="ComboBox_SelectionChanged">
|
||||||
<ComboBoxItem Content="Feld"></ComboBoxItem>
|
|
||||||
<ComboBoxItem Content="3 D"></ComboBoxItem>
|
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<Image x:Name="CompetitionImage"
|
<Image Name="CompetitionImage"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Height="80"
|
Height="80"
|
||||||
Width="80"
|
Width="80"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0 0 80 0"/>
|
Margin="0 0 80 0"
|
||||||
|
Source="{Binding CompetitionImage, Mode=TwoWay, TargetNullValue={x:Null}}" />
|
||||||
|
|
||||||
<DatePicker SelectedDateFormat="Long"
|
<DatePicker SelectedDateFormat="Long"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Apollon.Domain.Models;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -25,5 +26,35 @@ namespace Apollon.WPF.Views.Components
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ComboBox_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
List<string> competitions = new List<string>()
|
||||||
|
{
|
||||||
|
"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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Apollon.WPF.Views.Components"
|
xmlns:local="clr-namespace:Apollon.WPF.Views.Components"
|
||||||
|
xmlns:converter="clr-namespace:Apollon.WPF.Views.Components"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -92,7 +93,7 @@
|
|||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Image Grid.Column="2"
|
<Image Grid.Column="2"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Source="D:\Projekte\Apollon\Apollon\Apollon.WPF\Images\TargetField.png"
|
Source="{Binding CompetitionImage}"
|
||||||
Width="50"
|
Width="50"
|
||||||
Height="50">
|
Height="50">
|
||||||
<Image.Style>
|
<Image.Style>
|
||||||
@@ -105,6 +106,7 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</Image.Style>
|
</Image.Style>
|
||||||
|
|
||||||
</Image>
|
</Image>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Margin="5">
|
Margin="5"
|
||||||
|
Command="{Binding NavigateOverviewCommand}">
|
||||||
<iconPacks:PackIconMaterial Kind="ArrowLeft"
|
<iconPacks:PackIconMaterial Kind="ArrowLeft"
|
||||||
Height="25"
|
Height="25"
|
||||||
Width="35"
|
Width="35"
|
||||||
|
|||||||
Reference in New Issue
Block a user