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