Navigate to NavBar with data

This commit is contained in:
Natlinux81
2022-09-10 16:25:19 +02:00
parent b3c62b0104
commit 8b2b77bb56
8 changed files with 58 additions and 26 deletions

View File

@@ -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;
}
}
}