Add SplashScreen base

This commit is contained in:
achiez
2025-05-08 00:21:34 +03:00
parent 3f54df252c
commit 9a43166d49
7 changed files with 197 additions and 1 deletions
+1
View File
@@ -98,6 +98,7 @@
<!--Theme-->
<ResourceDictionary Source="Theme/WindowStyle/WindowStyle.xaml" />
<ResourceDictionary Source="Theme/WindowStyle/LoadingSplashScreenStyle.xaml" />
<ResourceDictionary Source="Theme/MaterialDesignThemes.Overrides.xaml" />
+1 -1
View File
@@ -49,7 +49,7 @@
</ItemGroup>
<ItemGroup>
<SplashScreen Include="Theme\SplashScreen.png" />
<Resource Include="Theme\SplashScreen.png" />
</ItemGroup>
<ItemGroup>
@@ -0,0 +1,107 @@
<ResourceDictionary x:Class="NebulaAuth.Theme.WindowStyle.LoadingSplashScreenStyle"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:NebulaAuth.Theme.WindowStyle">
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
</Style>
<ControlTemplate x:Key="WindowTemplate" TargetType="{x:Type Window}">
<!--<i:Interaction.Behaviors>
<local:WindowChromeLoadedBehavior />
</i:Interaction.Behaviors>-->
<Grid>
<Border x:Name="RootBorder"
Margin="{x:Static local:WindowChromeHelper.LayoutOffsetThickness}"
BorderBrush="Transparent"
BorderThickness="1"
Background="{DynamicResource BackgroundBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--<Grid x:Name="TitleBar"
Grid.Row="0"
Height="28"
Background="{DynamicResource Base100Brush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryBrush}"
Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"
FontSize="17" />
--><!-- Window Buttons --><!--
<StackPanel
HorizontalAlignment="Right"
Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="materialDesign:PackIcon">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</StackPanel.Resources>
<Button x:Name="MinimizeButton"
Click="OnMinimizeClick">
<materialDesign:PackIcon Kind="WindowMinimize" />
</Button>
<Button x:Name="MaximizeRestoreButton"
Click="OnMaximizeRestoreClick">
<materialDesign:PackIcon Kind="WindowMaximize" />
</Button>
<Button x:Name="CloseButton"
Click="OnCloseClick">
<materialDesign:PackIcon Kind="WindowClose" />
</Button>
</StackPanel>
</Grid>-->
<!-- Main Window Content -->
<Grid x:Name="MainGrid"
Grid.Row="1"
Background="{DynamicResource MainBackgroundBrush}">
<AdornerDecorator>
<ContentPresenter />
</AdornerDecorator>
</Grid>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsActive" Value="True">
<Setter TargetName="RootBorder" Property="BorderBrush" Value="#1e1e24" />
</Trigger>
<Trigger Property="WindowState" Value="Maximized">
<Setter TargetName="RootBorder" Property="BorderThickness"
Value="{Binding Source={x:Static local:WindowChromeHelper.WindowResizeBorderThickness}}" />
<Setter TargetName="RootBorder" Property="BorderBrush" Value="Transparent" />
<!--<Setter TargetName="MaximizeRestoreButton" Property="Content">
<Setter.Value>
<materialDesign:PackIcon Kind="WindowRestore" />
</Setter.Value>
</Setter>-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="LoadingSplashScreenStyle" TargetType="{x:Type Window}">
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome
CaptionHeight="38"
CornerRadius="0"
GlassFrameThickness="0"
NonClientFrameEdges="None"
ResizeBorderThickness="5"
UseAeroCaptionButtons="False" />
</Setter.Value>
</Setter>
<Setter Property="Template" Value="{StaticResource WindowTemplate}" />
</Style>
</ResourceDictionary>
@@ -0,0 +1,35 @@
using System.Windows;
namespace NebulaAuth.Theme.WindowStyle;
/// <summary>
/// Логика взаимодействия для WindowStyle.xaml
/// </summary>
partial class LoadingSplashScreenStyle
{
public LoadingSplashScreenStyle()
{
InitializeComponent();
}
private void OnCloseClick(object sender, RoutedEventArgs e)
{
var window = (Window) ((FrameworkElement) sender).TemplatedParent;
window.Close();
}
private void OnMaximizeRestoreClick(object sender, RoutedEventArgs e)
{
var window = (Window) ((FrameworkElement) sender).TemplatedParent;
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
}
private void OnMinimizeClick(object sender, RoutedEventArgs e)
{
var window = (Window) ((FrameworkElement) sender).TemplatedParent;
window.WindowState = WindowState.Minimized;
}
}
@@ -0,0 +1,24 @@
<theme:FontScaleWindow x:Class="NebulaAuth.View.LoadingSplashScreen"
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:NebulaAuth.View"
xmlns:theme="clr-namespace:NebulaAuth.Theme"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:windowStyle="clr-namespace:NebulaAuth.Theme.WindowStyle"
mc:Ignorable="d"
d:DesignHeight="512" d:DesignWidth="512"
SizeToContent="WidthAndHeight"
MaxWidth="512" MaxHeight="512"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
>
<Grid>
<Image Source="pack://application:,,,/Theme/SplashScreen.png"></Image>
</Grid>
</theme:FontScaleWindow>
@@ -0,0 +1,29 @@
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;
using NebulaAuth.Theme;
namespace NebulaAuth.View
{
/// <summary>
/// Логика взаимодействия для LoadingSplashScreen.xaml
/// </summary>
public partial class LoadingSplashScreen : FontScaleWindow
{
public LoadingSplashScreen()
{
InitializeComponent();
}
}
}