Modal Prototyp

This commit is contained in:
Natlinux81
2022-08-13 02:23:19 +02:00
parent bb3394b03f
commit 29013ae275
24 changed files with 302 additions and 100 deletions

View File

@@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="MahApps.Metro.IconPacks.Material" Version="4.11.0" /> <PackageReference Include="MahApps.Metro.IconPacks.Material" Version="4.11.0" />
<PackageReference Include="SimpleModal.WPF" Version="1.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -6,6 +6,7 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/ButtonTheme.xaml"/> <ResourceDictionary Source="Themes/ButtonTheme.xaml"/>
<ResourceDictionary Source="Themes/ModalTextblockTheme.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>

View File

@@ -25,7 +25,7 @@ namespace Apollon.WPF
{ {
MainWindow = new MainWindow() MainWindow = new MainWindow()
{ {
DataContext = new ApollonOverviewViewModel(_selectedTournamentStore) DataContext = new OverviewViewModel(_selectedTournamentStore)
}; };
MainWindow.Show(); MainWindow.Show();

View File

@@ -13,7 +13,7 @@
AllowsTransparency="True" AllowsTransparency="True"
WindowStyle="None" WindowStyle="None"
MouseDown="Window_MouseDown"> MouseDown="Window_MouseDown">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="35"> <RowDefinition Height="35">
@@ -23,7 +23,8 @@
</RowDefinition> </RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<views:ApollonOverviewView Grid.RowSpan="2"/> <views:AddTournamentView Grid.RowSpan="2"></views:AddTournamentView >
<!--<views:OverviewView Grid.RowSpan="2"/>
<Button Width="25" <Button Width="25"
Height="25" Height="25"
Padding="-4" Padding="-4"
@@ -66,7 +67,10 @@
HorizontalContentAlignment="Center" HorizontalContentAlignment="Center"
HorizontalAlignment="Right" Margin="0,2,104,8" HorizontalAlignment="Right" Margin="0,2,104,8"
Click="Button_Min" Click="Button_Min"
></Button> ></Button>-->
</Grid> </Grid>
</ScrollViewer>
</Window> </Window>

View File

@@ -6,7 +6,7 @@
<Setter Property="Foreground" Value="#0000a0"/> <Setter Property="Foreground" Value="#0000a0"/>
<Setter Property="FontFamily" Value="Arial"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="#808080"/> <Setter Property="Background" Value="#808080"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>

View File

@@ -0,0 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type TextBlock}"
x:Key="ModalTextBlock">
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="#0000a0"/>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
internal class AddEditDetailsViewModel
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
internal class AddTournametViewModel
{
}
}

View File

@@ -1,48 +0,0 @@
using Apollon.WPF.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
public class ApollonOverviewListingViewModel : ViewModelBase
{
private readonly ObservableCollection<ApollonOverviewListingItemViewModel> _apollonOverviewListingItemViewModels;
private readonly SelectedTournamentStore _selectedTournamentStore;
public IEnumerable<ApollonOverviewListingItemViewModel> ApollonOverviewListingItemViewModels => _apollonOverviewListingItemViewModels;
private ApollonOverviewListingItemViewModel _selectedOverviewListingItemViewModel;
public ApollonOverviewListingItemViewModel SelectedOverviewListingItemViewModel
{
get
{
return _selectedOverviewListingItemViewModel;
}
set
{
_selectedOverviewListingItemViewModel = value;
OnPropertyChanged(nameof(SelectedOverviewListingItemViewModel));
_selectedTournamentStore.SelectedTournament = _selectedOverviewListingItemViewModel.Tournament;
}
}
public ApollonOverviewListingViewModel(SelectedTournamentStore selectedTournamentStore)
{
_selectedTournamentStore = selectedTournamentStore;
_apollonOverviewListingItemViewModels = new ObservableCollection<ApollonOverviewListingItemViewModel>();
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden")));
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin")));
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal")));
}
}
}

View File

@@ -1,23 +0,0 @@
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 ApollonOverviewViewModel : ViewModelBase
{
public ApollonOverviewListingViewModel ApollonOverviewListingViewModel { get; }
public ApollonOverviewDetailsViewModel ApollonOverviewDetailsViewModel{ get; }
public ICommand AddTournamentCommand { get; }
public ApollonOverviewViewModel(SelectedTournamentStore _selectedTournamentStore)
{
ApollonOverviewListingViewModel = new ApollonOverviewListingViewModel(_selectedTournamentStore);
ApollonOverviewDetailsViewModel = new ApollonOverviewDetailsViewModel(_selectedTournamentStore);
}
}
}

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels namespace Apollon.WPF.ViewModels
{ {
public class ApollonOverviewDetailsViewModel : ViewModelBase public class OverviewDetailsViewModel : ViewModelBase
{ {
private readonly SelectedTournamentStore _selectedTournamentStore; private readonly SelectedTournamentStore _selectedTournamentStore;
@@ -22,7 +22,7 @@ namespace Apollon.WPF.ViewModels
public string Enddate => SelectedTournament?.Enddate ?? "kein Datum"; public string Enddate => SelectedTournament?.Enddate ?? "kein Datum";
public string Location => SelectedTournament?.Location ?? "kein Ort"; public string Location => SelectedTournament?.Location ?? "kein Ort";
public ApollonOverviewDetailsViewModel(SelectedTournamentStore selectedTournamentStore) public OverviewDetailsViewModel(SelectedTournamentStore selectedTournamentStore)
{ {
_selectedTournamentStore = selectedTournamentStore; _selectedTournamentStore = selectedTournamentStore;

View File

@@ -8,14 +8,14 @@ using System.Windows.Input;
namespace Apollon.WPF.ViewModels namespace Apollon.WPF.ViewModels
{ {
public class ApollonOverviewListingItemViewModel : ViewModelBase public class OverviewListingItemViewModel : ViewModelBase
{ {
public Tournament Tournament { get;} public Tournament Tournament { get;}
public string Tournamentname => Tournament.Tournamentname; public string Tournamentname => Tournament.Tournamentname;
public ICommand DeleteCommand { get; } public ICommand DeleteCommand { get; }
public ApollonOverviewListingItemViewModel(Tournament tournament) public OverviewListingItemViewModel(Tournament tournament)
{ {
Tournament = tournament; Tournament = tournament;
} }

View File

@@ -0,0 +1,48 @@
using Apollon.WPF.Models;
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
public class OverviewListingViewModel : ViewModelBase
{
private readonly ObservableCollection<OverviewListingItemViewModel> _apollonOverviewListingItemViewModels;
private readonly SelectedTournamentStore _selectedTournamentStore;
public IEnumerable<OverviewListingItemViewModel> ApollonOverviewListingItemViewModels => _apollonOverviewListingItemViewModels;
private OverviewListingItemViewModel _selectedOverviewListingItemViewModel;
public OverviewListingItemViewModel SelectedOverviewListingItemViewModel
{
get
{
return _selectedOverviewListingItemViewModel;
}
set
{
_selectedOverviewListingItemViewModel = value;
OnPropertyChanged(nameof(SelectedOverviewListingItemViewModel));
_selectedTournamentStore.SelectedTournament = _selectedOverviewListingItemViewModel.Tournament;
}
}
public OverviewListingViewModel(SelectedTournamentStore selectedTournamentStore)
{
_selectedTournamentStore = selectedTournamentStore;
_apollonOverviewListingItemViewModels = new ObservableCollection<OverviewListingItemViewModel>();
_apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden")));
_apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin")));
_apollonOverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal")));
}
}
}

View File

@@ -0,0 +1,23 @@
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 OverviewViewModel : ViewModelBase
{
public OverviewListingViewModel ApollonOverviewListingViewModel { get; }
public OverviewDetailsViewModel ApollonOverviewDetailsViewModel{ get; }
public ICommand AddTournamentCommand { get; }
public OverviewViewModel(SelectedTournamentStore _selectedTournamentStore)
{
ApollonOverviewListingViewModel = new OverviewListingViewModel(_selectedTournamentStore);
ApollonOverviewDetailsViewModel = new OverviewDetailsViewModel(_selectedTournamentStore);
}
}
}

View File

@@ -0,0 +1,19 @@
<UserControl x:Class="Apollon.WPF.Views.AddTournamentView"
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" xmlns:components="clr-namespace:Apollon.WPF.Views.Components"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="Erstellen eines Tourniers"
TextAlignment="Center"
FontFamily="Arial"
FontWeight="Bold"
FontSize="25"
Foreground="#0000a0"
Margin="10"/>
<components:AddEditDetails Margin="20 40"/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
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 AddTournamentView.xaml
/// </summary>
public partial class AddTournamentView : UserControl
{
public AddTournamentView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,87 @@
<UserControl x:Class="Apollon.WPF.Views.Components.AddEditDetails"
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.Components"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Height="450">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*" MaxWidth="250"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock Text="Veranstalter: "
Style="{StaticResource ModalTextBlock}"
Margin="0 20 0 0"/>
<TextBlock Text="Tourniername: "
Style="{StaticResource ModalTextBlock}"
Margin="0 20 0 0"/>
<TextBlock Text="Kategorie: "
Style="{StaticResource ModalTextBlock}"
Margin="0 20 0 0"/>
<TextBlock Text="Startdatum: "
Style="{StaticResource ModalTextBlock}"
Margin="0 20 0 0"/>
<TextBlock Text="Enddatum: "
Style="{StaticResource ModalTextBlock}"
Margin="0 20 0 0"/>
<TextBlock Text="Veranstaltungsort: "
Style="{StaticResource ModalTextBlock}"
Margin="0 20 0 0"/>
</StackPanel>
<StackPanel Grid.Column="1">
<TextBox Text="{Binding Organisation}"
FontFamily="Arial"
FontSize="14"
Margin="0 15 0 0"
Padding="2"/>
<TextBox Text="{Binding Tournamentname}"
TextAlignment="Center"
FontFamily="Arial"
FontSize="14"
Margin="0 20 0 0"
Padding="2"
/>
<ComboBox ItemsSource="{Binding Category}"
Margin="0 20 0 15"/>
<DatePicker MaxWidth="150"
HorizontalAlignment="Center"/>
<DatePicker MaxWidth="150"
HorizontalAlignment="Center"/>
<TextBox Text="{Binding Location}"
TextAlignment="Center"
FontFamily="Arial"
FontSize="14"
Margin="0 20 0 0"/>
</StackPanel>
<WrapPanel Grid.Row="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
Margin="20">
<Button Content="Speichern"
Command="{Binding SubmitCommand}"
Style="{StaticResource ModernButton}"
Width="100"
Height="25"
HorizontalAlignment="Left"
Margin="0 0 80 0"
IsEnabled="False"/>
<Button Content="Abbrechen"
Command="{Binding CancelCommand}"
Style="{StaticResource ModernButton}"
Width="100"
Height="25"/>
</WrapPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
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.Components
{
/// <summary>
/// Interaction logic for AddEditDetails.xaml
/// </summary>
public partial class AddEditDetails : UserControl
{
public AddEditDetails()
{
InitializeComponent();
}
}
}

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="Apollon.WPF.Views.Components.ApollonOverViewListing" <UserControl x:Class="Apollon.WPF.Views.Components.OverViewListing"
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"

View File

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

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="Apollon.WPF.Views.Components.ApollonOverviewDetails" <UserControl x:Class="Apollon.WPF.Views.Components.OverviewDetails"
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"

View File

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

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="Apollon.WPF.Views.ApollonOverviewView" <UserControl x:Class="Apollon.WPF.Views.OverviewView"
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"
@@ -80,7 +80,7 @@
FontSize="16" FontSize="16"
Foreground="#0000a0"> Foreground="#0000a0">
</TextBlock> </TextBlock>
<components:ApollonOverViewListing Height="400" <components:OverViewListing Height="400"
DataContext="{Binding ApollonOverviewListingViewModel}"/> DataContext="{Binding ApollonOverviewListingViewModel}"/>
</StackPanel> </StackPanel>
@@ -95,7 +95,7 @@
FontWeight="Bold" FontWeight="Bold"
FontSize="16" FontSize="16"
Foreground="#0000a0"/> Foreground="#0000a0"/>
<components:ApollonOverviewDetails Width="320" <components:OverviewDetails Width="320"
DataContext="{Binding ApollonOverviewDetailsViewModel}"/> DataContext="{Binding ApollonOverviewDetailsViewModel}"/>
<Button Style="{StaticResource ModernButton}" <Button Style="{StaticResource ModernButton}"
Content="Turnier bearbeiten" Content="Turnier bearbeiten"

View File

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