try NavBar

This commit is contained in:
Natlinux
2022-11-27 15:18:07 +01:00
parent a2c926f915
commit d45c0cc1d5
17 changed files with 69 additions and 122 deletions

View File

@@ -44,7 +44,7 @@ namespace Apollon.WPF.Commands
detailsViewModel.StartDate, detailsViewModel.StartDate,
detailsViewModel.EndDate, detailsViewModel.EndDate,
detailsViewModel.Location, detailsViewModel.Location,
detailsViewModel.Rounds, detailsViewModel.Groups,
detailsViewModel.Targets); detailsViewModel.Targets);
try try
@@ -52,7 +52,7 @@ namespace Apollon.WPF.Commands
await _tournamentStore.Add(tournament); await _tournamentStore.Add(tournament);
_modalNavigationStore.Close(); _modalNavigationStore.Close();
_navigationStore.CurrentViewModel = new PreparationViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore); _navigationStore.CurrentViewModel = new GroupsViewModel(_selectedTournamentsStore, _navigationStore, _modalNavigationStore, _tournamentStore);
} }
catch (Exception) catch (Exception)

View File

@@ -39,7 +39,7 @@ namespace Apollon.WPF.Commands
detailsViewModel.StartDate, detailsViewModel.StartDate,
detailsViewModel.EndDate, detailsViewModel.EndDate,
detailsViewModel.Location, detailsViewModel.Location,
detailsViewModel.Rounds, detailsViewModel.Groups,
detailsViewModel.Targets); detailsViewModel.Targets);
try try

View File

@@ -46,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:PreparationViewModel}"> <DataTemplate DataType="{x:Type vms:GroupsViewModel}">
<views:PreparationView/> <views:GroupsView/>
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type vms:NameListViewModel}"> <DataTemplate DataType="{x:Type vms:NameListViewModel}">
<views:RootdatesView/> <views:RootdatesView/>

View File

@@ -135,7 +135,7 @@ namespace Apollon.WPF.ViewModels
} }
private int _rounds; private int _rounds;
public int Rounds public int Groups
{ {
get get
{ {
@@ -144,7 +144,7 @@ namespace Apollon.WPF.ViewModels
set set
{ {
_rounds = value; _rounds = value;
OnPropertyChanged(nameof(Rounds)); OnPropertyChanged(nameof(Groups));
} }
} }

View File

@@ -32,7 +32,7 @@ namespace Apollon.WPF.ViewModels
StartDate = tournament.StartDate, StartDate = tournament.StartDate,
EndDate = tournament.EndDate, EndDate = tournament.EndDate,
Location = tournament.Location, Location = tournament.Location,
Rounds = tournament.Rounds, Groups = tournament.Rounds,
Targets = tournament.Targets, Targets = tournament.Targets,
}; };

View File

@@ -1,12 +1,24 @@
using System; using Apollon.WPF.Commands;
using Apollon.WPF.Stores;
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
{ {
public class GroupsViewModel : ViewModelBase public class GroupsViewModel : ViewModelBase
{ {
public TournamentDetailsViewModel TournamentDetailsViewModel { get; }
public ICommand NavigateOverviewCommand { get; }
public GroupsViewModel(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

@@ -8,7 +8,7 @@ using System.Windows.Input;
namespace Apollon.WPF.ViewModels namespace Apollon.WPF.ViewModels
{ {
public class NavBarTournamentDetailsViewModel : ViewModelBase public class NavBarPreparationViewModel : ViewModelBase
{ {
public ICommand NavigateArchersCommand { get;} public ICommand NavigateArchersCommand { get;}
public ICommand NavigateGroupsCommand { get;} public ICommand NavigateGroupsCommand { get;}

View File

@@ -27,7 +27,7 @@ namespace Apollon.WPF.ViewModels
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 NavigateTournamentDetailsCommand { get; } public ICommand NavigatePreparationCommand { get; }
public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore) public OverviewDetailsViewModel(SelectedTournamentsStore selectedTournamentStore, NavigationStore navigationStore, ModalNavigationStore modalNavigationStore,TournamentsStore tournamentsStore)
{ {
@@ -35,7 +35,7 @@ namespace Apollon.WPF.ViewModels
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged; _selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
NavigateTournamentDetailsCommand = new NavigateCommand<PreparationViewModel>(navigationStore, () => new PreparationViewModel(_selectedTournamentStore,navigationStore, modalNavigationStore, tournamentsStore)); NavigatePreparationCommand = new NavigateCommand<GroupsViewModel>(navigationStore, () => new GroupsViewModel(selectedTournamentStore, navigationStore, modalNavigationStore, tournamentsStore));
} }
protected override void Dispose() protected override void Dispose()

View File

@@ -46,7 +46,7 @@ namespace Apollon.WPF.ViewModels
public bool HasErrorMessage => !string.IsNullOrEmpty(ErrorMessage); public bool HasErrorMessage => !string.IsNullOrEmpty(ErrorMessage);
public ICommand AddTournamentCommand { get; } public ICommand OpenAddTournamentCommand { get; }
public ICommand LoadTournamentsCommand { get; } public ICommand LoadTournamentsCommand { get; }
public ICommand NavigateNameListCommand { get; } public ICommand NavigateNameListCommand { get; }
@@ -57,7 +57,7 @@ namespace Apollon.WPF.ViewModels
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,navigationStore, modalNavigationStore,tournamentStore); OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,navigationStore, modalNavigationStore,tournamentStore);
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore); LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore); OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, navigationStore, selectedTournamentStore);
NavigateNameListCommand = new NavigateCommand<NameListViewModel>(navigationStore, () => new NameListViewModel()); NavigateNameListCommand = new NavigateCommand<NameListViewModel>(navigationStore, () => new NameListViewModel());
} }

View File

@@ -1,28 +0,0 @@
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

@@ -1,4 +1,4 @@
<UserControl x:Class="Apollon.WPF.Views.Components.NavBarView" <UserControl x:Class="Apollon.WPF.Views.Components.NavBarPreparationView"
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"
@@ -8,6 +8,17 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<StackPanel>
<Button Width="35"
Height="35"
Background="Transparent"
BorderThickness="0"
Command="{Binding NavigateOverviewCommand}">
<iconPacks:PackIconMaterial Kind="ArrowLeft"
Height="25"
Width="35"
Foreground="#0000a0"/>
</Button>
<Menu Height="450" <Menu Height="450"
Background="Transparent" Background="Transparent"
Margin="0,20,0,0"> Margin="0,20,0,0">
@@ -363,6 +374,6 @@
</MenuItem> </MenuItem>
</MenuItem> </MenuItem>
</Menu> </Menu>
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

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

View File

@@ -289,7 +289,7 @@
Width="150" Width="150"
Margin="10" Margin="10"
Cursor="Hand" Cursor="Hand"
Command="{Binding NavigateTournamentDetailsCommand}"> Command="{Binding NavigatePreparationCommand}">
<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

@@ -3,10 +3,30 @@
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"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:components="clr-namespace:Apollon.WPF.Views.Components"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Apollon.WPF.Views" xmlns:local="clr-namespace:Apollon.WPF.Views"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid Margin="20" >
<Grid.RowDefinitions>
<RowDefinition Height="120"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="2" Grid.Row="2"
BorderBrush="#0000a0"
BorderThickness="1"
CornerRadius="2">
<TextBlock Text="Gruppen" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="Gruppen" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<components:TournamentDetails Grid.Column="1" Margin="0,35,0,10" HorizontalAlignment="Center" DataContext="{Binding TournamentDetailsViewModel}"/>
<components:NavBarPreparationView Grid.Row="1" Margin="0 ,0 ,2, 30"/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -61,7 +61,7 @@
Width="210" Width="210"
Margin="40" Margin="40"
Cursor="Hand" Cursor="Hand"
Command="{Binding AddTournamentCommand}"/> Command="{Binding OpenAddTournamentCommand}"/>
<Button Style="{StaticResource ModernButton}" <Button Style="{StaticResource ModernButton}"
Content="Namenliste pflegen" Content="Namenliste pflegen"

View File

@@ -1,40 +0,0 @@
<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"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:components="clr-namespace:Apollon.WPF.Views.Components"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Apollon.WPF.Views"
mc:Ignorable="d">
<Grid Margin="20" >
<Grid.RowDefinitions>
<RowDefinition Height="120"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="2" Grid.Row="2"
BorderBrush="#0000a0"
BorderThickness="1"
CornerRadius="2"></Border>
<Button Width="35"
Height="35"
Background="Transparent"
BorderThickness="0"
HorizontalAlignment="Left"
Margin="5"
Command="{Binding NavigateOverviewCommand}">
<iconPacks:PackIconMaterial Kind="ArrowLeft"
Height="25"
Width="35"
Foreground="#0000a0"/>
</Button>
<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

@@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Apollon.WPF.Views
{
/// <summary>
/// Interaction logic for TournamentDetailsView.xaml
/// </summary>
public partial class PreparationView : UserControl
{
public PreparationView()
{
InitializeComponent();
}
}
}