Navigate to NavBar with data
This commit is contained in:
@@ -50,8 +50,8 @@ namespace Apollon.WPF.Commands
|
|||||||
await _tournamentStore.Add(tournament);
|
await _tournamentStore.Add(tournament);
|
||||||
|
|
||||||
_modalNavigationStore.Close();
|
_modalNavigationStore.Close();
|
||||||
//_navigationStore.CurrentViewModel = new NavBarViewModel(_navigationStore, _selectedTournamentsStore, _modalNavigationStore,_tournamentStore);
|
_navigationStore.CurrentViewModel = new NavBarViewModel(_navigationStore, _selectedTournamentsStore, _modalNavigationStore, _tournamentStore);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace Apollon.WPF.Commands
|
|||||||
await _tournamentStore.Update(tournament);
|
await _tournamentStore.Update(tournament);
|
||||||
|
|
||||||
_modalNavigationStore.Close();
|
_modalNavigationStore.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Apollon.WPF.Commands;
|
using Apollon.Domain.Models;
|
||||||
|
using Apollon.WPF.Commands;
|
||||||
using Apollon.WPF.Stores;
|
using Apollon.WPF.Stores;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,12 +13,28 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public class NavBarViewModel : ViewModelBase
|
public class NavBarViewModel : ViewModelBase
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly SelectedTournamentsStore _selectedTournamentsStore;
|
||||||
|
|
||||||
|
private Tournament SelectedTournament => _selectedTournamentsStore.SelectedTournament;
|
||||||
|
|
||||||
|
public bool HasSelectedTournament => SelectedTournament != null;
|
||||||
|
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 ?? "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";
|
||||||
|
public int Rounds => SelectedTournament?.Rounds ?? 0;
|
||||||
|
|
||||||
|
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
|
||||||
public ICommand NavigateOverviewCommand { get; }
|
public ICommand NavigateOverviewCommand { get; }
|
||||||
public NavBarViewModel(NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
|
public NavBarViewModel(NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
|
||||||
{
|
{
|
||||||
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(navigationStore, () => new OverviewViewModel(tournamentsStore, selectedTournamentsStore, modalNavigationStore,navigationStore));
|
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(navigationStore, () => new OverviewViewModel(tournamentsStore, selectedTournamentsStore, modalNavigationStore,navigationStore));
|
||||||
|
|
||||||
|
_selectedTournamentsStore = selectedTournamentsStore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using Apollon.Domain.Models;
|
using Apollon.Domain.Models;
|
||||||
|
using Apollon.WPF.Commands;
|
||||||
using Apollon.WPF.Stores;
|
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
|
||||||
{
|
{
|
||||||
@@ -23,11 +25,15 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public string Location => SelectedTournament?.Location ?? "kein Ort";
|
public string Location => SelectedTournament?.Location ?? "kein Ort";
|
||||||
public int Rounds => SelectedTournament?.Rounds ?? 0;
|
public int Rounds => SelectedTournament?.Rounds ?? 0;
|
||||||
|
|
||||||
public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore)
|
public ICommand NavigateNavBarCommand { get; }
|
||||||
|
|
||||||
|
public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore)
|
||||||
{
|
{
|
||||||
_selectedTournamentStore = selectedTournamentStore;
|
_selectedTournamentStore = selectedTournamentStore;
|
||||||
|
|
||||||
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
|
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
|
||||||
|
|
||||||
|
NavigateNavBarCommand = new NavigateCommand<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore, selectedTournamentStore, modalNavigationStore, tournamentsStore));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose()
|
protected override void Dispose()
|
||||||
|
|||||||
@@ -47,19 +47,16 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public bool HasErrorMessage => !string.IsNullOrEmpty(ErrorMessage);
|
public bool HasErrorMessage => !string.IsNullOrEmpty(ErrorMessage);
|
||||||
|
|
||||||
public ICommand AddTournamentCommand { get; }
|
public ICommand AddTournamentCommand { get; }
|
||||||
public ICommand LoadTournamentsCommand { get; }
|
public ICommand LoadTournamentsCommand { get; }
|
||||||
public ICommand NavigateNavBarCommand { get; }
|
|
||||||
|
|
||||||
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore,
|
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore,
|
||||||
ModalNavigationStore modalNavigationStore, NavigationStore navigationStore)
|
ModalNavigationStore modalNavigationStore, NavigationStore navigationStore)
|
||||||
{
|
{
|
||||||
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
|
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
|
||||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
|
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,navigationStore, modalNavigationStore,tournamentStore);
|
||||||
|
|
||||||
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
|
||||||
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
|
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
|
||||||
NavigateNavBarCommand = new NavigateCommand<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore,selectedTournamentStore,modalNavigationStore,tournamentStore));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OverviewViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore,
|
public static OverviewViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore,
|
||||||
|
|||||||
@@ -218,7 +218,26 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</TextBlock.Style>
|
</TextBlock.Style>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
<Button
|
||||||
|
Content="Turnier öffnen"
|
||||||
|
FontSize="16"
|
||||||
|
Height="40"
|
||||||
|
Width="210"
|
||||||
|
Margin="40"
|
||||||
|
Cursor="Hand"
|
||||||
|
Command="{Binding NavigateNavBarCommand}">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource ModernButton}">
|
||||||
|
<Setter Property="Visibility" Value="Hidden"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding HasSelectedTournament}" Value="True">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -18,14 +18,14 @@
|
|||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<WrapPanel HorizontalAlignment="Center">
|
<WrapPanel HorizontalAlignment="Center">
|
||||||
<TextBlock Text="Organisation"
|
<TextBlock Text="{Binding Organisation}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
FontFamily="Arial"
|
FontFamily="Arial"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Foreground="#0000a0"
|
Foreground="#0000a0"
|
||||||
Margin="10"/>
|
Margin="10"/>
|
||||||
<TextBlock Text="TournamentName"
|
<TextBlock Text="{Binding TournamentName}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
FontFamily="Arial"
|
FontFamily="Arial"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
@@ -34,14 +34,14 @@
|
|||||||
Margin="10"/>
|
Margin="10"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
<WrapPanel HorizontalAlignment="Center">
|
<WrapPanel HorizontalAlignment="Center">
|
||||||
<TextBlock Text="Competition"
|
<TextBlock Text="{Binding Competition}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
FontFamily="Arial"
|
FontFamily="Arial"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
Foreground="#0000a0"
|
Foreground="#0000a0"
|
||||||
Margin="10"/>
|
Margin="10"/>
|
||||||
<TextBlock Text="Location"
|
<TextBlock Text="{Binding Location}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
FontFamily="Arial"
|
FontFamily="Arial"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
FontSize="14"
|
FontSize="14"
|
||||||
Foreground="#0000a0"
|
Foreground="#0000a0"
|
||||||
Margin="10"/>
|
Margin="10"/>
|
||||||
<TextBlock Text="StartDate"
|
<TextBlock Text="{Binding StartDate}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
FontFamily="Arial"
|
FontFamily="Arial"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
FontSize="14"
|
FontSize="14"
|
||||||
Foreground="#0000a0"
|
Foreground="#0000a0"
|
||||||
Margin="10"/>
|
Margin="10"/>
|
||||||
<TextBlock Text="EndDate"
|
<TextBlock Text="{Binding EndDate}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
FontFamily="Arial"
|
FontFamily="Arial"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Image Grid.Column="2"
|
<Image Grid.Column="2"
|
||||||
Source="D:\Projekte\Apollon\Apollon\Apollon.WPF\Images\TargetField.png"
|
Source="{Binding CompetitionImage}"
|
||||||
Width="70"
|
Width="70"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -156,14 +156,6 @@
|
|||||||
<components:OverviewDetails Width="320"
|
<components:OverviewDetails Width="320"
|
||||||
DataContext="{Binding OverviewDetailsViewModel}"/>
|
DataContext="{Binding OverviewDetailsViewModel}"/>
|
||||||
|
|
||||||
<Button Style="{StaticResource ModernButton}"
|
|
||||||
Content="Namensliste"
|
|
||||||
FontSize="16"
|
|
||||||
Height="40"
|
|
||||||
Width="210"
|
|
||||||
Margin="40"
|
|
||||||
Cursor="Hand"
|
|
||||||
Command="{Binding NavigateNavBarCommand}"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user