next Try implement Layout

This commit is contained in:
Natlinux
2023-02-08 20:15:55 +01:00
parent 4ef5f60ca0
commit 7911aa46de
7 changed files with 27 additions and 63 deletions

View File

@@ -1,4 +1,5 @@
using Apollon.Domain.Models;
using Apollon.WPF.Services;
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using System;
@@ -11,13 +12,15 @@ namespace Apollon.WPF.Commands
private readonly TournamentsStore _tournamentStore;
private readonly ModalNavigationStore _modalNavigationStore;
private AddTournamentViewModel _addTournamentViewModel;
private readonly NavigationService<GroupsViewModel> _navigationService;
public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
public AddTournamentCommand(AddTournamentViewModel addTournamentViewModel, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationService<GroupsViewModel> navigationService)
{
_addTournamentViewModel = addTournamentViewModel;
_tournamentStore = tournamentStore;
_modalNavigationStore = modalNavigationStore;
_modalNavigationStore = modalNavigationStore;
_navigationService = navigationService;
}
public override async Task ExecuteAsync(object parameter)
@@ -45,7 +48,7 @@ namespace Apollon.WPF.Commands
await _tournamentStore.Add(tournament);
_modalNavigationStore.Close();
_navigationService.Navigate();
}
catch (Exception)
{

View File

@@ -1,4 +1,5 @@
using Apollon.WPF.Stores;
using Apollon.WPF.Services;
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using System;
using System.Collections.Generic;
@@ -12,17 +13,18 @@ namespace Apollon.WPF.Commands
{
private readonly TournamentsStore _tournamentStore;
private readonly ModalNavigationStore _modalNavigationStore;
private readonly NavigationService<GroupsViewModel> _navigationService;
public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
public OpenAddTournamentCommand(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationService<GroupsViewModel> navigationService)
{
_tournamentStore = tournamentStore;
_tournamentStore = tournamentStore;
_modalNavigationStore = modalNavigationStore;
_navigationService = navigationService;
}
public override void Execute(object parameter)
{
AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore);
AddTournamentViewModel addTournamentViewModel = new AddTournamentViewModel(_tournamentStore, _modalNavigationStore, _navigationService);
_modalNavigationStore.CurrentViewModel = addTournamentViewModel;
}
}

View File

@@ -38,8 +38,16 @@
<custom:Modal Grid.RowSpan="2" Panel.ZIndex="1" IsOpen="{Binding IsModalOpen}">
<ContentControl Margin="30" Content="{Binding CurrentModalViewModel}"/>
</custom:Modal>
<views:Layout Grid.RowSpan="2"/>
<Border CornerRadius="5"
Grid.RowSpan="2">
<Border.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="{StaticResource ColorPrimary4}" Offset="0.2"/>
<GradientStop Color="{StaticResource ColorPrimary5}" Offset="0.8"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<ContentControl Content="{Binding CurrentViewModel}">
<ContentControl.Resources>

View File

@@ -1,4 +1,5 @@
using Apollon.WPF.Commands;
using Apollon.WPF.Services;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
@@ -13,9 +14,9 @@ namespace Apollon.WPF.ViewModels
{
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
public AddTournamentViewModel(TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore, NavigationService<GroupsViewModel> navigationService)
{
ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore);
ICommand submitCommand = new AddTournamentCommand(this, tournamentStore,modalNavigationStore, navigationService);
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
AddEditDetailsViewModel = new AddEditDetailsViewModel(submitCommand, cancelCommand);
}

View File

@@ -52,7 +52,7 @@ namespace Apollon.WPF.ViewModels
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore ,groupNavigationService);
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore);
OpenAddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore, groupNavigationService);
NavigateNameListCommand = new NavigateCommand<NameListViewModel>(NameListNavigationService);
}

View File

@@ -1,22 +0,0 @@
<UserControl x:Class="Apollon.WPF.Views.Layout"
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:local="clr-namespace:Apollon.WPF.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Border BorderThickness="2"
CornerRadius="5"
Grid.RowSpan="2"
Grid.ColumnSpan="3">
<Border.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="{StaticResource ColorPrimary4}" Offset="0.2"/>
<GradientStop Color="{StaticResource ColorPrimary5}" Offset="0.8"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</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 Layout.xaml
/// </summary>
public partial class Layout : UserControl
{
public Layout()
{
InitializeComponent();
}
}
}