preparationview

This commit is contained in:
Natlinux
2022-11-24 21:18:55 +01:00
parent 4a47b178f4
commit 34e648dc8a
8 changed files with 43 additions and 28 deletions

View File

@@ -52,7 +52,7 @@ namespace Apollon.WPF.Commands
await _tournamentStore.Add(tournament); await _tournamentStore.Add(tournament);
_modalNavigationStore.Close(); _modalNavigationStore.Close();
_navigationStore.CurrentViewModel = new TournamentDetailsViewModel(_navigationStore, _selectedTournamentsStore, _modalNavigationStore, _tournamentStore); _navigationStore.CurrentViewModel = new PreparationViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore);
} }
catch (Exception) catch (Exception)

View File

@@ -27,13 +27,7 @@
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type vms:WarningDeleteViewModel}"> <DataTemplate DataType="{x:Type vms:WarningDeleteViewModel}">
<views:WarningDeleteView/> <views:WarningDeleteView/>
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type vms:OverviewViewModel}">
<views:OverviewView Content="{Binding CurrentViewModel}" DataContext="{Binding OverviewViewModel}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type vms:AddEditDetailsViewModel}">
<components:AddEditDetails/>
</DataTemplate>
</Window.Resources> </Window.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -41,8 +35,7 @@
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<custom:Modal Grid.RowSpan="2" Panel.ZIndex="1" IsOpen="{Binding IsModalOpen}"> <custom:Modal Grid.RowSpan="2" Panel.ZIndex="1" IsOpen="{Binding IsModalOpen}">
<ContentControl Margin="30" Content="{Binding CurrentModalViewModel}"/> <ContentControl Margin="30" Content="{Binding CurrentModalViewModel}"/>
</custom:Modal> </custom:Modal>
@@ -53,8 +46,8 @@
<DataTemplate DataType="{x:Type vms:OverviewViewModel}"> <DataTemplate DataType="{x:Type vms:OverviewViewModel}">
<views:OverviewView/> <views:OverviewView/>
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type vms:TournamentDetailsViewModel}"> <DataTemplate DataType="{x:Type vms:PreparationViewModel}">
<views:TournamentDetailsView/> <views:PreparationView/>
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type vms:NameListViewModel}"> <DataTemplate DataType="{x:Type vms:NameListViewModel}">
<views:RootdatesView/> <views:RootdatesView/>

View File

@@ -35,7 +35,7 @@ namespace Apollon.WPF.ViewModels
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged; _selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
NavigateTournamentDetailsCommand = new NavigateCommand<TournamentDetailsViewModel>(navigationStore, () => new TournamentDetailsViewModel(navigationStore, selectedTournamentStore, modalNavigationStore, tournamentsStore)); NavigateTournamentDetailsCommand = new NavigateCommand<PreparationViewModel>(navigationStore, () => new PreparationViewModel(_selectedTournamentStore,navigationStore, modalNavigationStore, tournamentsStore));
} }
protected override void Dispose() protected override void Dispose()

View File

@@ -0,0 +1,28 @@
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
{
public class PreparationViewModel : ViewModelBase
{
public TournamentDetailsViewModel TournamentDetailsViewModel { get; }
public ICommand NavigateOverviewCommand { get; }
public PreparationViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
{
TournamentDetailsViewModel = new TournamentDetailsViewModel(selectedTournamentStore);
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentsStore, navigationStore));
}
}
}

View File

@@ -11,9 +11,7 @@ using System.Windows.Input;
namespace Apollon.WPF.ViewModels namespace Apollon.WPF.ViewModels
{ {
public class TournamentDetailsViewModel : ViewModelBase public class TournamentDetailsViewModel : ViewModelBase
{ {
private readonly SelectedTournamentsStore _selectedTournamentsStore; private readonly SelectedTournamentsStore _selectedTournamentsStore;
private Tournament SelectedTournament => _selectedTournamentsStore.SelectedTournament; private Tournament SelectedTournament => _selectedTournamentsStore.SelectedTournament;
@@ -28,12 +26,10 @@ 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 int Targets => SelectedTournament?.Targets ?? 0; public int Targets => SelectedTournament?.Targets ?? 0;
public ICommand NavigateOverviewCommand { get; }
public TournamentDetailsViewModel(NavigationStore navigationStore, SelectedTournamentsStore selectedTournamentsStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentsStore)
{
NavigateOverviewCommand = new NavigateCommand<OverviewViewModel>(navigationStore, () => OverviewViewModel.LoadViewModel( selectedTournamentsStore, modalNavigationStore, tournamentsStore, navigationStore));
public TournamentDetailsViewModel(SelectedTournamentsStore selectedTournamentsStore)
{
_selectedTournamentsStore = selectedTournamentsStore; _selectedTournamentsStore = selectedTournamentsStore;
} }
} }

View File

@@ -307,8 +307,7 @@
Height="35" Height="35"
Width="150" Width="150"
Margin="10" Margin="10"
Cursor="Hand" Cursor="Hand">
Command="{Binding NavigateNavBarCommand}">
<Button.Style> <Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ModernButton}"> <Style TargetType="Button" BasedOn="{StaticResource ModernButton}">
<Setter Property="Visibility" Value="Hidden"/> <Setter Property="Visibility" Value="Hidden"/>
@@ -326,8 +325,7 @@
Height="35" Height="35"
Width="150" Width="150"
Margin="10" Margin="10"
Cursor="Hand" Cursor="Hand">
Command="{Binding NavigateNavBarCommand}">
<Button.Style> <Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ModernButton}"> <Style TargetType="Button" BasedOn="{StaticResource ModernButton}">
<Setter Property="Visibility" Value="Hidden"/> <Setter Property="Visibility" Value="Hidden"/>

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="Apollon.WPF.Views.TournamentDetailsView" <UserControl x:Class="Apollon.WPF.Views.PreparationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -34,7 +34,7 @@
Foreground="#0000a0"/> Foreground="#0000a0"/>
</Button> </Button>
<components:TournamentDetails Grid.Column="1" Margin="0,35,0,10" HorizontalAlignment="Center"/> <components:TournamentDetails Grid.Column="1" Margin="0,35,0,10" HorizontalAlignment="Center" DataContext="{Binding TournamentDetailsViewModel}"/>
<components:NavBarView Grid.Row="1" Margin="0 ,0 ,2, 30"/> <components:NavBarView Grid.Row="1" Margin="0 ,0 ,2, 30"/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -18,9 +18,9 @@ namespace Apollon.WPF.Views
/// <summary> /// <summary>
/// Interaction logic for TournamentDetailsView.xaml /// Interaction logic for TournamentDetailsView.xaml
/// </summary> /// </summary>
public partial class TournamentDetailsView : UserControl public partial class PreparationView : UserControl
{ {
public TournamentDetailsView() public PreparationView()
{ {
InitializeComponent(); InitializeComponent();
} }