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);
_modalNavigationStore.Close();
_navigationStore.CurrentViewModel = new TournamentDetailsViewModel(_navigationStore, _selectedTournamentsStore, _modalNavigationStore, _tournamentStore);
_navigationStore.CurrentViewModel = new PreparationViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore);
}
catch (Exception)

View File

@@ -28,12 +28,6 @@
<DataTemplate DataType="{x:Type vms:WarningDeleteViewModel}">
<views:WarningDeleteView/>
</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>
<Grid>
<Grid.RowDefinitions>
@@ -42,7 +36,6 @@
</Grid.RowDefinitions>
<custom:Modal Grid.RowSpan="2" Panel.ZIndex="1" IsOpen="{Binding IsModalOpen}">
<ContentControl Margin="30" Content="{Binding CurrentModalViewModel}"/>
</custom:Modal>
@@ -53,8 +46,8 @@
<DataTemplate DataType="{x:Type vms:OverviewViewModel}">
<views:OverviewView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vms:TournamentDetailsViewModel}">
<views:TournamentDetailsView/>
<DataTemplate DataType="{x:Type vms:PreparationViewModel}">
<views:PreparationView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vms:NameListViewModel}">
<views:RootdatesView/>

View File

@@ -35,7 +35,7 @@ namespace Apollon.WPF.ViewModels
_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()

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
{
public class TournamentDetailsViewModel : ViewModelBase
{
private readonly SelectedTournamentsStore _selectedTournamentsStore;
private Tournament SelectedTournament => _selectedTournamentsStore.SelectedTournament;
@@ -29,11 +27,9 @@ namespace Apollon.WPF.ViewModels
public int Rounds => SelectedTournament?.Rounds ?? 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;
}
}

View File

@@ -307,8 +307,7 @@
Height="35"
Width="150"
Margin="10"
Cursor="Hand"
Command="{Binding NavigateNavBarCommand}">
Cursor="Hand">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ModernButton}">
<Setter Property="Visibility" Value="Hidden"/>
@@ -326,8 +325,7 @@
Height="35"
Width="150"
Margin="10"
Cursor="Hand"
Command="{Binding NavigateNavBarCommand}">
Cursor="Hand">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ModernButton}">
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -34,7 +34,7 @@
Foreground="#0000a0"/>
</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"/>
</Grid>
</UserControl>

View File

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