finish addedit
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -62,7 +63,7 @@ namespace Apollon.WPF.ViewModels
|
||||
set
|
||||
{
|
||||
_competitionImage = value;
|
||||
OnPropertyChanged(nameof(CompetitionImage));
|
||||
OnPropertyChanged(nameof(CompetitionImage));;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Apollon.WPF.ViewModels
|
||||
Organisation = tournament.Organisation,
|
||||
TournamentName = tournament.TournamentName,
|
||||
Competition = tournament.Competition,
|
||||
CompetitionImage = tournament.CompetitionImage,
|
||||
StartDate = tournament.StartDate,
|
||||
EndDate = tournament.EndDate,
|
||||
Location = tournament.Location,
|
||||
|
||||
@@ -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<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 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";
|
||||
|
||||
@@ -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<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore));
|
||||
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
|
||||
NavigateNavBarCommand = new NavigateCommand<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore,selectedTournamentStore,modalNavigationStore,tournamentStore));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -76,24 +76,23 @@
|
||||
IsEditable="True"
|
||||
Grid.Column="1"
|
||||
Height="30"
|
||||
Width="150"
|
||||
Width="200"
|
||||
FontSize="16"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<ComboBoxItem Content="Halle"></ComboBoxItem>
|
||||
<ComboBoxItem Content="im Freien"></ComboBoxItem>
|
||||
<ComboBoxItem Content="Feld"></ComboBoxItem>
|
||||
<ComboBoxItem Content="3 D"></ComboBoxItem>
|
||||
HorizontalAlignment="Left"
|
||||
Loaded="ComboBox_Loaded"
|
||||
SelectionChanged="ComboBox_SelectionChanged">
|
||||
</ComboBox>
|
||||
|
||||
<Image x:Name="CompetitionImage"
|
||||
<Image Name="CompetitionImage"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="2"
|
||||
Height="80"
|
||||
Width="80"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0 0 80 0"/>
|
||||
Margin="0 0 80 0"
|
||||
Source="{Binding CompetitionImage, Mode=TwoWay, TargetNullValue={x:Null}}" />
|
||||
|
||||
<DatePicker SelectedDateFormat="Long"
|
||||
Grid.Row="3"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Apollon.Domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -25,5 +26,35 @@ namespace Apollon.WPF.Views.Components
|
||||
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: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">
|
||||
<Grid>
|
||||
@@ -92,7 +93,7 @@
|
||||
</TextBlock>
|
||||
<Image Grid.Column="2"
|
||||
Grid.Row="2"
|
||||
Source="D:\Projekte\Apollon\Apollon\Apollon.WPF\Images\TargetField.png"
|
||||
Source="{Binding CompetitionImage}"
|
||||
Width="50"
|
||||
Height="50">
|
||||
<Image.Style>
|
||||
@@ -105,6 +106,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
|
||||
</Image>
|
||||
</WrapPanel>
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="5">
|
||||
Margin="5"
|
||||
Command="{Binding NavigateOverviewCommand}">
|
||||
<iconPacks:PackIconMaterial Kind="ArrowLeft"
|
||||
Height="25"
|
||||
Width="35"
|
||||
|
||||
Reference in New Issue
Block a user