improve:更新弹窗
This commit is contained in:
@@ -774,7 +774,7 @@ namespace Ink_Canvas.Helpers
|
||||
return;
|
||||
|
||||
// 检查鼠标是否在当前窗口所在的屏幕上
|
||||
var mousePosition = System.Windows.Forms.Control.MousePosition;
|
||||
var mousePosition = Control.MousePosition;
|
||||
var currentScreen = Screen.FromPoint(mousePosition);
|
||||
|
||||
// 无论屏幕是否变化,都检查热键状态
|
||||
@@ -880,7 +880,7 @@ namespace Ink_Canvas.Helpers
|
||||
// 策略2:在多屏幕环境下,检查鼠标是否在当前窗口所在的屏幕上
|
||||
if (_isMultiScreenMode)
|
||||
{
|
||||
var mousePosition = System.Windows.Forms.Control.MousePosition;
|
||||
var mousePosition = Control.MousePosition;
|
||||
var mouseScreen = Screen.FromPoint(mousePosition);
|
||||
|
||||
if (mouseScreen == _currentScreen)
|
||||
|
||||
@@ -2700,6 +2700,19 @@ namespace Ink_Canvas
|
||||
|
||||
public void BtnExit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 如果当前在设置面板中,需要先恢复无焦点模式状态
|
||||
if (BorderSettings.Visibility == Visibility.Visible)
|
||||
{
|
||||
// 如果用户没有在设置中修改无焦点模式,则恢复之前的状态
|
||||
if (!userChangedNoFocusModeInSettings && wasNoFocusModeBeforeSettings)
|
||||
{
|
||||
Settings.Advanced.IsNoFocusMode = true;
|
||||
ToggleSwitchNoFocusMode.IsOn = true;
|
||||
ApplyNoFocusMode();
|
||||
}
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
App.IsAppExitByUser = true;
|
||||
// 不设置 CloseIsFromButton = true,让它也经过确认流程
|
||||
Close();
|
||||
@@ -2707,6 +2720,18 @@ namespace Ink_Canvas
|
||||
|
||||
public void BtnRestart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (BorderSettings.Visibility == Visibility.Visible)
|
||||
{
|
||||
// 如果用户没有在设置中修改无焦点模式,则恢复之前的状态
|
||||
if (!userChangedNoFocusModeInSettings && wasNoFocusModeBeforeSettings)
|
||||
{
|
||||
Settings.Advanced.IsNoFocusMode = true;
|
||||
ToggleSwitchNoFocusMode.IsOn = true;
|
||||
ApplyNoFocusMode();
|
||||
}
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m");
|
||||
App.IsAppExitByUser = true;
|
||||
// 不设置 CloseIsFromButton = true,让它也经过确认流程
|
||||
|
||||
@@ -29,4 +29,13 @@
|
||||
<SolidColorBrush x:Key="BoardFloatBarSelectedBackground" Color="#2563eb" />
|
||||
<SolidColorBrush x:Key="BoardFloatBarSelectedBorderBrush" Color="#2563eb" />
|
||||
<SolidColorBrush x:Key="BoardFloatBarSelectedForeground" Color="White" />
|
||||
|
||||
<!-- 历史回滚窗口主题颜色 -->
|
||||
<SolidColorBrush x:Key="HistoryWindowPrimaryBrush" Color="#3b82f6"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowPrimaryHoverBrush" Color="#2563eb"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowPrimaryPressedBrush" Color="#1d4ed8"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowCardBackgroundBrush" Color="#2a2a2a"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowCardBorderBrush" Color="#404040"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowTextPrimaryBrush" Color="#f9fafb"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowTextSecondaryBrush" Color="#9ca3af"/>
|
||||
</ResourceDictionary>
|
||||
@@ -29,4 +29,13 @@
|
||||
<SolidColorBrush x:Key="BoardFloatBarSelectedBackground" Color="#2563eb" />
|
||||
<SolidColorBrush x:Key="BoardFloatBarSelectedBorderBrush" Color="#2563eb" />
|
||||
<SolidColorBrush x:Key="BoardFloatBarSelectedForeground" Color="White" />
|
||||
|
||||
<!-- 历史回滚窗口主题颜色 -->
|
||||
<SolidColorBrush x:Key="HistoryWindowPrimaryBrush" Color="#2563eb"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowPrimaryHoverBrush" Color="#1d4ed8"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowPrimaryPressedBrush" Color="#1e40af"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowCardBackgroundBrush" Color="#f8fafc"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowCardBorderBrush" Color="#e5e7eb"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowTextPrimaryBrush" Color="#1f2937"/>
|
||||
<SolidColorBrush x:Key="HistoryWindowTextSecondaryBrush" Color="#6b7280"/>
|
||||
</ResourceDictionary>
|
||||
@@ -7,61 +7,68 @@
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
|
||||
mc:Ignorable="d"
|
||||
ui:WindowHelper.UseModernWindowStyle = "False"
|
||||
ui:WindowHelper.UseModernWindowStyle="False"
|
||||
ui:WindowHelper.SystemBackdropType="Mica"
|
||||
Title="InkCanvasForClass CE有新版本可用" Height="650" Width="900" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"
|
||||
WindowStartupLocation="CenterScreen" WindowStyle="None"
|
||||
Background="Transparent">
|
||||
<Window.Template>
|
||||
<ControlTemplate TargetType="Window">
|
||||
<Border Background="#f8fafc"
|
||||
CornerRadius="16"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0">
|
||||
<Border Background="{DynamicResource SettingsPageBackground}"
|
||||
CornerRadius="8"
|
||||
BorderBrush="{DynamicResource SettingsPageBorderBrush}"
|
||||
BorderThickness="1">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="30" ShadowDepth="0" Opacity="0.15"/>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="20" ShadowDepth="0" Opacity="0.1"/>
|
||||
</Border.Effect>
|
||||
<ContentPresenter/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Window.Template>
|
||||
<Window.Resources>
|
||||
<!-- 主题相关颜色资源 -->
|
||||
<SolidColorBrush x:Key="UpdateWindowPrimaryBrush" Color="#2563eb"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowPrimaryHoverBrush" Color="#1d4ed8"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowPrimaryPressedBrush" Color="#1e40af"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowCardBackgroundBrush" Color="#f8fafc"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowCardBorderBrush" Color="#e5e7eb"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowTextPrimaryBrush" Color="#1f2937"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowTextSecondaryBrush" Color="#6b7280"/>
|
||||
<SolidColorBrush x:Key="UpdateWindowCloseButtonBrush" Color="#666666"/>
|
||||
|
||||
<!-- 渐变背景定义 -->
|
||||
<LinearGradientBrush x:Key="HeaderGradient" StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#3b82f6" Offset="0"/>
|
||||
<GradientStop Color="#ffffff" Offset="1"/>
|
||||
<GradientStop Color="#2563eb" Offset="0"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- 现代按钮样式 -->
|
||||
<Style x:Key="ModernPrimaryButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="#3b82f6"/>
|
||||
<Setter Property="Background" Value="{DynamicResource UpdateWindowPrimaryBrush}"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
<Setter Property="Padding" Value="24,12"/>
|
||||
<Setter Property="Height" Value="48"/>
|
||||
<Setter Property="Width" Value="320"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Padding" Value="20,10"/>
|
||||
<Setter Property="Height" Value="40"/>
|
||||
<Setter Property="MinWidth" Value="200"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="12"
|
||||
CornerRadius="6"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#3b82f6" BlurRadius="8" ShadowDepth="0" Opacity="0.3"/>
|
||||
</Border.Effect>
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#2563eb"/>
|
||||
<Setter Property="Background" Value="{DynamicResource UpdateWindowPrimaryHoverBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#1d4ed8"/>
|
||||
<Setter Property="Background" Value="{DynamicResource UpdateWindowPrimaryPressedBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -70,33 +77,40 @@
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ModernSecondaryButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="#374151"/>
|
||||
<Setter Property="Background" Value="{DynamicResource SettingsPageBackground}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource UpdateWindowTextPrimaryBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="#e5e7eb"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SettingsPageBorderBrush}"/>
|
||||
<Setter Property="FontWeight" Value="Medium"/>
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
<Setter Property="Padding" Value="24,12"/>
|
||||
<Setter Property="Height" Value="48"/>
|
||||
<Setter Property="Width" Value="320"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Padding" Value="20,10"/>
|
||||
<Setter Property="Height" Value="40"/>
|
||||
<Setter Property="MinWidth" Value="200"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="12"
|
||||
CornerRadius="6"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#f9fafb"/>
|
||||
<Setter Property="BorderBrush" Value="#d1d5db"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.1"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#f3f4f6"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.2"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -106,31 +120,39 @@
|
||||
|
||||
<Style x:Key="ModernTertiaryButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#6b7280"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource UpdateWindowTextSecondaryBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FontWeight" Value="Medium"/>
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
<Setter Property="Padding" Value="24,12"/>
|
||||
<Setter Property="Height" Value="48"/>
|
||||
<Setter Property="Width" Value="320"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Padding" Value="20,10"/>
|
||||
<Setter Property="Height" Value="40"/>
|
||||
<Setter Property="MinWidth" Value="200"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="12"
|
||||
CornerRadius="6"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#f9fafb"/>
|
||||
<Setter Property="Foreground" Value="#374151"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.1"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource UpdateWindowTextPrimaryBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#f3f4f6"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.2"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -143,15 +165,12 @@
|
||||
<Grid Margin="0,0,0,0" Background="Transparent">
|
||||
<ui:SimpleStackPanel VerticalAlignment="Stretch" Spacing="0">
|
||||
<!-- 统一的主容器 -->
|
||||
<Border Background="White" CornerRadius="16" Margin="0,0,0,0"
|
||||
BorderThickness="0" Padding="0">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="20" ShadowDepth="0" Opacity="0.08"/>
|
||||
</Border.Effect>
|
||||
<Border Background="{DynamicResource SettingsPageBackground}" CornerRadius="8" Margin="0,0,0,0"
|
||||
BorderThickness="1" BorderBrush="{DynamicResource SettingsPageBorderBrush}" Padding="0">
|
||||
|
||||
<ui:SimpleStackPanel Spacing="0">
|
||||
<!-- 现代化标题栏 -->
|
||||
<Border Background="{StaticResource HeaderGradient}" CornerRadius="16,16,0,0" Margin="0,0,0,0"
|
||||
<Border Background="{StaticResource HeaderGradient}" CornerRadius="8,8,0,0" Margin="0,0,0,0"
|
||||
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
|
||||
<Grid>
|
||||
<!-- 标题栏内容 -->
|
||||
@@ -160,8 +179,8 @@
|
||||
<Image Source="/Resources/Icons-fluent/party.png" Width="24" Height="24"/>
|
||||
</Border>
|
||||
<ui:SimpleStackPanel Orientation="Vertical" Spacing="4">
|
||||
<TextBlock Text="新版本发布" FontSize="28" FontWeight="Bold" Foreground="#1e40af" TextAlignment="Left"/>
|
||||
<TextBlock Text="InkCanvasForClass CE 为您带来全新体验" FontSize="16" TextAlignment="Left" Foreground="#374151" Opacity="0.9"/>
|
||||
<TextBlock Text="新版本发布" FontSize="24" FontWeight="Bold" Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}" TextAlignment="Left"/>
|
||||
<TextBlock Text="InkCanvasForClass CE 为您带来全新体验" FontSize="14" TextAlignment="Left" Foreground="{DynamicResource UpdateWindowTextSecondaryBrush}"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
@@ -183,17 +202,25 @@
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<Path Data="M8,8 L16,16 M16,8 L8,16"
|
||||
Stroke="#374151"
|
||||
Stroke="{DynamicResource UpdateWindowCloseButtonBrush}"
|
||||
StrokeThickness="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#e5e7eb"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.1"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#d1d5db"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.2"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -203,15 +230,15 @@
|
||||
</Border>
|
||||
|
||||
<!-- 内容标题 -->
|
||||
<Border Background="#f8fafc" Padding="24,20,24,16">
|
||||
<Border Background="{DynamicResource UpdateWindowCardBackgroundBrush}" Padding="24,20,24,16">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Border Background="#3b82f6" CornerRadius="8" Padding="8">
|
||||
<Border Background="{DynamicResource UpdateWindowPrimaryBrush}" CornerRadius="8" Padding="8">
|
||||
<TextBlock Text="📝" FontSize="16" Foreground="White"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ui:SimpleStackPanel Orientation="Vertical" Spacing="2">
|
||||
<TextBlock Text="更新内容" FontSize="18" FontWeight="SemiBold" Foreground="#1f2937"/>
|
||||
<TextBlock Text="查看本次更新的详细内容" FontSize="14" Foreground="#6b7280"/>
|
||||
<TextBlock Text="更新内容" FontSize="18" FontWeight="SemiBold" Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}"/>
|
||||
<TextBlock Text="查看本次更新的详细内容" FontSize="14" Foreground="{DynamicResource UpdateWindowTextSecondaryBrush}"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
@@ -219,7 +246,7 @@
|
||||
<!-- 内容区域 -->
|
||||
<ui:ScrollViewerEx Margin="0" VerticalScrollBarVisibility="Auto" Height="200" PanningMode="VerticalOnly">
|
||||
<mdxam:MarkdownScrollViewer x:Name="markdownContent" xml:space="preserve"
|
||||
Foreground="#374151" MarkdownStyleName="GithubLike"
|
||||
Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}" MarkdownStyleName="GithubLike"
|
||||
Margin="24,16,24,16">
|
||||
# InkCanvasForClass v5.0.2更新
|
||||
|
||||
@@ -239,32 +266,32 @@
|
||||
</Border>
|
||||
|
||||
<!-- 现代化版本信息 -->
|
||||
<Border Background="#f8fafc" Margin="0,0,0,0" Padding="24,20">
|
||||
<Border Background="{DynamicResource UpdateWindowCardBackgroundBrush}" Margin="0,0,0,0" Padding="24,20">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="24">
|
||||
<ui:SimpleStackPanel Orientation="Vertical" Spacing="4" HorizontalAlignment="Center">
|
||||
<TextBlock Text="版本信息" FontSize="14" FontWeight="Medium" Foreground="#6b7280"/>
|
||||
<TextBlock Text="版本信息" FontSize="14" FontWeight="Medium" Foreground="{DynamicResource UpdateWindowTextSecondaryBrush}"/>
|
||||
<TextBlock x:Name="updateVersionInfo" Text="本次更新: 4.9.1 -> 5.9.1"
|
||||
FontWeight="SemiBold" FontSize="16" Foreground="#1f2937" TextAlignment="Center"/>
|
||||
FontWeight="SemiBold" FontSize="16" Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}" TextAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<Border Width="1" Background="#e5e7eb" Margin="0,8,0,8"/>
|
||||
<Border Width="1" Background="{DynamicResource SettingsPageBorderBrush}" Margin="0,8,0,8"/>
|
||||
<ui:SimpleStackPanel Orientation="Vertical" Spacing="4" HorizontalAlignment="Center">
|
||||
<TextBlock Text="发布日期" FontSize="14" FontWeight="Medium" Foreground="#6b7280"/>
|
||||
<TextBlock Text="发布日期" FontSize="14" FontWeight="Medium" Foreground="{DynamicResource UpdateWindowTextSecondaryBrush}"/>
|
||||
<TextBlock x:Name="updateDateInfo" Text="2024年8月4日发布更新"
|
||||
FontSize="16" Foreground="#1f2937" TextAlignment="Center"/>
|
||||
FontSize="16" Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}" TextAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 现代化按钮区域 -->
|
||||
<Border Background="#f8fafc" Margin="0,0,0,0" Padding="32,24" CornerRadius="0,0,16,16">
|
||||
<Border Background="{DynamicResource UpdateWindowCardBackgroundBrush}" Margin="0,0,0,0" Padding="32,24" CornerRadius="0,0,8,8">
|
||||
<ui:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" Spacing="16">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="12" HorizontalAlignment="Center">
|
||||
<Border Background="#3b82f6" CornerRadius="8" Padding="8">
|
||||
<Border Background="{DynamicResource UpdateWindowPrimaryBrush}" CornerRadius="8" Padding="8">
|
||||
<TextBlock Text="⚡" FontSize="16" Foreground="White"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<TextBlock Text="选择更新方式" FontWeight="SemiBold" FontSize="18"
|
||||
Foreground="#1f2937" VerticalAlignment="Center"/>
|
||||
Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
<!-- 立即更新按钮 -->
|
||||
@@ -289,7 +316,7 @@
|
||||
</Border>
|
||||
|
||||
<!-- 现代化下载进度指示器 -->
|
||||
<Border x:Name="DownloadProgressPanel" Background="#f8fafc"
|
||||
<Border x:Name="DownloadProgressPanel" Background="{DynamicResource UpdateWindowCardBackgroundBrush}"
|
||||
Margin="0,0,0,0" Padding="32,24" Visibility="Collapsed">
|
||||
<ui:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" Spacing="16">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="12" HorizontalAlignment="Center">
|
||||
@@ -298,21 +325,18 @@
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<TextBlock Text="正在下载更新" FontWeight="SemiBold" FontSize="18"
|
||||
Foreground="#1f2937" VerticalAlignment="Center"/>
|
||||
Foreground="{DynamicResource UpdateWindowTextPrimaryBrush}" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
<!-- 现代化进度条 -->
|
||||
<Border Background="#f3f4f6" CornerRadius="12" Height="8" Width="400">
|
||||
<Border x:Name="ProgressFill" Background="#3b82f6" CornerRadius="12"
|
||||
<Border Background="{DynamicResource SettingsPageBackground}" CornerRadius="6" Height="6" Width="400">
|
||||
<Border x:Name="ProgressFill" Background="{DynamicResource UpdateWindowPrimaryBrush}" CornerRadius="6"
|
||||
Width="0" HorizontalAlignment="Left">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#3b82f6" BlurRadius="8" ShadowDepth="0" Opacity="0.4"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<TextBlock x:Name="DownloadProgressText" Text="正在准备下载..."
|
||||
FontSize="14" Foreground="#6b7280" HorizontalAlignment="Center"/>
|
||||
FontSize="14" Foreground="{DynamicResource UpdateWindowTextSecondaryBrush}" HorizontalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using MdXaml;
|
||||
using System;
|
||||
@@ -54,6 +55,128 @@ namespace Ink_Canvas
|
||||
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用当前主题设置
|
||||
/// </summary>
|
||||
private void ApplyCurrentTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 根据主窗口的主题设置应用主题
|
||||
switch (MainWindow.Settings.Appearance.Theme)
|
||||
{
|
||||
case 0: // 浅色主题
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
|
||||
UpdateColorsForLightTheme();
|
||||
break;
|
||||
case 1: // 深色主题
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
|
||||
UpdateColorsForDarkTheme();
|
||||
break;
|
||||
case 2: // 跟随系统
|
||||
if (IsSystemThemeLight())
|
||||
{
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
|
||||
UpdateColorsForLightTheme();
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
|
||||
UpdateColorsForDarkTheme();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"应用主题时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新为浅色主题颜色
|
||||
/// </summary>
|
||||
private void UpdateColorsForLightTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 更新主要颜色资源
|
||||
Resources["UpdateWindowPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x25, 0x63, 0xeb));
|
||||
Resources["UpdateWindowPrimaryHoverBrush"] = new SolidColorBrush(Color.FromRgb(0x1d, 0x4e, 0xd8));
|
||||
Resources["UpdateWindowPrimaryPressedBrush"] = new SolidColorBrush(Color.FromRgb(0x1e, 0x40, 0xaf));
|
||||
Resources["UpdateWindowCardBackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0xf8, 0xfa, 0xfc));
|
||||
Resources["UpdateWindowCardBorderBrush"] = new SolidColorBrush(Color.FromRgb(0xe5, 0xe7, 0xeb));
|
||||
Resources["UpdateWindowTextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x1f, 0x29, 0x37));
|
||||
Resources["UpdateWindowTextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x6b, 0x72, 0x80));
|
||||
Resources["UpdateWindowCloseButtonBrush"] = new SolidColorBrush(Color.FromRgb(0x66, 0x66, 0x66));
|
||||
|
||||
// 更新渐变背景
|
||||
var gradient = new LinearGradientBrush();
|
||||
gradient.StartPoint = new Point(0, 0);
|
||||
gradient.EndPoint = new Point(1, 1);
|
||||
gradient.GradientStops.Add(new GradientStop(Color.FromRgb(0x25, 0x63, 0xeb), 0));
|
||||
gradient.GradientStops.Add(new GradientStop(Colors.White, 1));
|
||||
Resources["HeaderGradient"] = gradient;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"更新浅色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新为深色主题颜色
|
||||
/// </summary>
|
||||
private void UpdateColorsForDarkTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 更新主要颜色资源
|
||||
Resources["UpdateWindowPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x3b, 0x82, 0xf6));
|
||||
Resources["UpdateWindowPrimaryHoverBrush"] = new SolidColorBrush(Color.FromRgb(0x25, 0x63, 0xeb));
|
||||
Resources["UpdateWindowPrimaryPressedBrush"] = new SolidColorBrush(Color.FromRgb(0x1d, 0x4e, 0xd8));
|
||||
Resources["UpdateWindowCardBackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0x2a, 0x2a, 0x2a));
|
||||
Resources["UpdateWindowCardBorderBrush"] = new SolidColorBrush(Color.FromRgb(0x40, 0x40, 0x40));
|
||||
Resources["UpdateWindowTextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0xf9, 0xfa, 0xfb));
|
||||
Resources["UpdateWindowTextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x9c, 0xa3, 0xaf));
|
||||
Resources["UpdateWindowCloseButtonBrush"] = new SolidColorBrush(Color.FromRgb(0x9c, 0xa3, 0xaf));
|
||||
|
||||
// 更新渐变背景
|
||||
var gradient = new LinearGradientBrush();
|
||||
gradient.StartPoint = new Point(0, 0);
|
||||
gradient.EndPoint = new Point(1, 1);
|
||||
gradient.GradientStops.Add(new GradientStop(Color.FromRgb(0x3b, 0x82, 0xf6), 0));
|
||||
gradient.GradientStops.Add(new GradientStop(Color.FromRgb(0x1f, 0x1f, 0x1f), 1));
|
||||
Resources["HeaderGradient"] = gradient;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"更新深色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查系统是否为浅色主题
|
||||
/// </summary>
|
||||
private bool IsSystemThemeLight()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"))
|
||||
{
|
||||
if (key?.GetValue("AppsUseLightTheme") is int value)
|
||||
{
|
||||
return value == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 如果无法读取注册表,默认返回true(浅色主题)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 存储更新版本信息
|
||||
public string CurrentVersion { get; set; }
|
||||
public string NewVersion { get; set; }
|
||||
@@ -74,6 +197,9 @@ namespace Ink_Canvas
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 应用当前主题
|
||||
ApplyCurrentTheme();
|
||||
|
||||
// 设置版本信息
|
||||
CurrentVersion = currentVersion;
|
||||
NewVersion = newVersion;
|
||||
|
||||
@@ -8,234 +8,230 @@
|
||||
mc:Ignorable="d"
|
||||
ui:WindowHelper.UseModernWindowStyle="False"
|
||||
ui:WindowHelper.SystemBackdropType="Mica"
|
||||
Title="历史版本回滚" Height="650" Width="900" ResizeMode="CanResize"
|
||||
WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"
|
||||
Title="历史版本回滚" Height="650" Width="900" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen" WindowStyle="None"
|
||||
Background="Transparent" MinHeight="550" MinWidth="800">
|
||||
<Window.Template>
|
||||
<ControlTemplate TargetType="Window">
|
||||
<Border Background="#f8fafc"
|
||||
CornerRadius="16"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0">
|
||||
<Border Background="{DynamicResource SettingsPageBackground}"
|
||||
CornerRadius="8"
|
||||
BorderBrush="{DynamicResource SettingsPageBorderBrush}"
|
||||
BorderThickness="1">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="30" ShadowDepth="0" Opacity="0.15"/>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="20" ShadowDepth="0" Opacity="0.1"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<!-- 标题栏 -->
|
||||
<Border Background="Transparent" Height="40" VerticalAlignment="Top">
|
||||
<Border Background="{DynamicResource SettingsPageBackground}" Height="48" VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<TextBlock Text="{TemplateBinding Title}"
|
||||
FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="#374151"
|
||||
FontSize="14" FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource SettingsPageForeground}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="20,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center">
|
||||
<Button Name="MinimizeButton"
|
||||
Width="40" Height="30"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="MinimizeButton_Click"
|
||||
Margin="0,0,2,0">
|
||||
<TextBlock Text="−" FontSize="16" Foreground="#6b7280"/>
|
||||
</Button>
|
||||
<Button Name="CloseButton"
|
||||
Width="40" Height="30"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="CloseButton_Click">
|
||||
<TextBlock Text="×" FontSize="16" Foreground="#6b7280"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
Margin="16,0,0,0"/>
|
||||
<!-- 最小化按钮 -->
|
||||
<Button Name="MinimizeButton"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,8,40,0"
|
||||
Width="32" Height="32"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="MinimizeButton_Click"
|
||||
Cursor="Hand"
|
||||
ToolTip="最小化">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<TextBlock Text="−" FontSize="14"
|
||||
Foreground="{DynamicResource SettingsPageForeground}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.1"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#FF2563eb" Opacity="0.2"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<Button Name="CloseButton"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,8,8,0"
|
||||
Width="32" Height="32"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="CloseButton_Click"
|
||||
Cursor="Hand"
|
||||
ToolTip="关闭">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<TextBlock Text="×" FontSize="14"
|
||||
Foreground="{DynamicResource SettingsPageForeground}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#ef4444" Opacity="0.1"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#ef4444" Opacity="0.2"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- 内容区域 -->
|
||||
<ContentPresenter Margin="0,40,0,0"/>
|
||||
<ContentPresenter Margin="0,48,0,0"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Window.Template>
|
||||
<Window.Resources>
|
||||
<!-- 现代化按钮样式 -->
|
||||
<Style x:Key="ModernPrimaryButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="#3b82f6"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
<Setter Property="Padding" Value="24,12"/>
|
||||
<Setter Property="Height" Value="48"/>
|
||||
<Setter Property="Width" Value="320"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="12"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#3b82f6" BlurRadius="8" ShadowDepth="0" Opacity="0.3"/>
|
||||
</Border.Effect>
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#2563eb"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#1d4ed8"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="#9ca3af"/>
|
||||
<Setter Property="Foreground" Value="#6b7280"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 现代化ComboBox样式 -->
|
||||
<Style x:Key="ModernComboBox" TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="#374151"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="#d1d5db"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Height" Value="40"/>
|
||||
<Setter Property="Padding" Value="12,8"/>
|
||||
</Style>
|
||||
|
||||
<!-- ComboBoxItem样式 -->
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="#374151"/>
|
||||
<Setter Property="Padding" Value="12,8"/>
|
||||
<Setter Property="Margin" Value="0,1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
Margin="2">
|
||||
<ContentPresenter Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#f0f9ff"/>
|
||||
<Setter Property="Foreground" Value="#1e40af"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#3b82f6"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- 主题相关颜色资源 -->
|
||||
<SolidColorBrush x:Key="PrimaryBrush" Color="#FF2563eb"/>
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#FF1f2937"/>
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#FF6b7280"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Background="Transparent">
|
||||
<!-- 主内容区域 -->
|
||||
<Border Background="White" CornerRadius="16" Margin="20"
|
||||
BorderThickness="0" Padding="0">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="20" ShadowDepth="0" Opacity="0.08"/>
|
||||
</Border.Effect>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<Grid Background="Transparent">
|
||||
<!-- 主内容区域 -->
|
||||
<ui:SimpleStackPanel VerticalAlignment="Stretch" Spacing="0" Margin="20">
|
||||
<!-- 标题区域 -->
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="12" Margin="0,0,0,16">
|
||||
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="16" Padding="12" Margin="0,0,0,0">
|
||||
<ui:SymbolIcon Symbol="Undo" FontSize="20" Foreground="White"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ui:SimpleStackPanel VerticalAlignment="Center" Spacing="4">
|
||||
<TextBlock Text="历史版本回滚" FontSize="22" FontWeight="Bold"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<TextBlock Text="选择要回滚到的历史版本" FontSize="14"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<ui:SimpleStackPanel VerticalAlignment="Stretch" Spacing="0" Margin="28">
|
||||
<!-- 标题区域 -->
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="12" Margin="0,32,0,24">
|
||||
<Border Background="#3b82f6" CornerRadius="8" Width="40" Height="40"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="↶" FontSize="20" Foreground="White"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ui:SimpleStackPanel VerticalAlignment="Center" Spacing="4">
|
||||
<TextBlock Text="历史版本回滚" FontSize="28" FontWeight="Bold"
|
||||
Foreground="#1f2937"/>
|
||||
<TextBlock Text="选择要回滚到的历史版本" FontSize="14"
|
||||
Foreground="#6b7280"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
<!-- 版本选择卡片 -->
|
||||
<Border Background="#f8fafc" CornerRadius="12" Padding="20" Margin="0,0,0,20">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="8" ShadowDepth="0" Opacity="0.05"/>
|
||||
</Border.Effect>
|
||||
<ui:SimpleStackPanel Spacing="12">
|
||||
<TextBlock Text="选择版本" FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="#374151"/>
|
||||
<ComboBox x:Name="VersionComboBox"
|
||||
Width="400" Height="40"
|
||||
<!-- 版本选择卡片 -->
|
||||
<Border Background="{DynamicResource SettingsPageBackground}"
|
||||
BorderBrush="{DynamicResource SettingsPageBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="12"
|
||||
Margin="0,0,0,16"
|
||||
Padding="20">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="8" ShadowDepth="0" Opacity="0.05"/>
|
||||
</Border.Effect>
|
||||
<ui:SimpleStackPanel Spacing="16">
|
||||
<TextBlock Text="选择版本" FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<ComboBox x:Name="VersionComboBox"
|
||||
Width="300" Height="40"
|
||||
DisplayMemberPath="Version"
|
||||
SelectionChanged="VersionComboBox_SelectionChanged"
|
||||
Background="White"
|
||||
BorderBrush="#d1d5db"
|
||||
BorderThickness="1"
|
||||
FontSize="14"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
SelectionChanged="VersionComboBox_SelectionChanged"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 发布说明卡片 -->
|
||||
<Border Background="{DynamicResource SettingsPageBackground}"
|
||||
BorderBrush="{DynamicResource SettingsPageBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="12"
|
||||
Margin="0,0,0,16"
|
||||
Padding="20">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="8" ShadowDepth="0" Opacity="0.05"/>
|
||||
</Border.Effect>
|
||||
<ui:SimpleStackPanel Spacing="16">
|
||||
<TextBlock Text="版本更新说明" FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<Border Background="{DynamicResource SettingsPageBackground}"
|
||||
BorderBrush="{DynamicResource SettingsPageBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
MinHeight="150" MaxHeight="250">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="4" ShadowDepth="0" Opacity="0.03"/>
|
||||
</Border.Effect>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Padding="16">
|
||||
<mdxam:MarkdownScrollViewer x:Name="ReleaseNotesViewer"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
MarkdownStyleName="GithubLike"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<ui:SimpleStackPanel Spacing="16" Margin="0,0,0,16">
|
||||
<Button x:Name="RollbackButton"
|
||||
Content="回滚到此版本"
|
||||
HorizontalAlignment="Center"
|
||||
Click="RollbackButton_Click"
|
||||
Style="{DynamicResource AccentButtonStyle}"
|
||||
Width="200" Height="48"
|
||||
FontSize="16" FontWeight="SemiBold"/>
|
||||
|
||||
<!-- 发布说明卡片 -->
|
||||
<Border Background="#f8fafc" CornerRadius="12" Padding="20" Margin="0,0,0,20">
|
||||
<!-- 下载进度面板 -->
|
||||
<Border x:Name="DownloadProgressPanel"
|
||||
Background="{DynamicResource SettingsPageBackground}"
|
||||
BorderBrush="{DynamicResource SettingsPageBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="12"
|
||||
Visibility="Collapsed"
|
||||
Margin="0,8,0,0"
|
||||
Padding="24">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#000000" BlurRadius="8" ShadowDepth="0" Opacity="0.05"/>
|
||||
</Border.Effect>
|
||||
<ui:SimpleStackPanel Spacing="12">
|
||||
<TextBlock Text="版本更新说明" FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="#374151"/>
|
||||
<Border Background="White" BorderBrush="#e5e7eb" BorderThickness="1"
|
||||
CornerRadius="8" MinHeight="200" MaxHeight="300">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Padding="16">
|
||||
<mdxam:MarkdownScrollViewer x:Name="ReleaseNotesViewer"
|
||||
Foreground="#374151"
|
||||
MarkdownStyleName="GithubLike"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<ProgressBar x:Name="DownloadProgressBar"
|
||||
Width="300" Height="8"
|
||||
Minimum="0" Maximum="100" Value="0"/>
|
||||
<TextBlock x:Name="DownloadProgressText"
|
||||
Text="正在下载..."
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
HorizontalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<ui:SimpleStackPanel Spacing="16" Margin="0,0,0,32">
|
||||
<Button x:Name="RollbackButton"
|
||||
Content="回滚到此版本"
|
||||
Style="{StaticResource ModernPrimaryButton}"
|
||||
Click="RollbackButton_Click"/>
|
||||
|
||||
<!-- 下载进度面板 -->
|
||||
<StackPanel x:Name="DownloadProgressPanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="Collapsed"
|
||||
Margin="0,8,0,0">
|
||||
<Border Background="#f0f9ff" BorderBrush="#3b82f6"
|
||||
BorderThickness="1" CornerRadius="8" Padding="16">
|
||||
<ui:SimpleStackPanel Spacing="12">
|
||||
<ProgressBar x:Name="DownloadProgressBar"
|
||||
Width="400" Height="8"
|
||||
Minimum="0" Maximum="100" Value="0"
|
||||
Background="#e0f2fe"
|
||||
Foreground="#3b82f6"/>
|
||||
<TextBlock x:Name="DownloadProgressText"
|
||||
Text="正在下载..."
|
||||
FontSize="14"
|
||||
Foreground="#1e40af"
|
||||
HorizontalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Window>
|
||||
@@ -1,4 +1,5 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -8,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
// Added for OrderByDescending
|
||||
|
||||
@@ -31,17 +33,117 @@ namespace Ink_Canvas
|
||||
{
|
||||
InitializeComponent();
|
||||
this.channel = channel;
|
||||
|
||||
// 应用当前主题
|
||||
ApplyCurrentTheme();
|
||||
|
||||
LoadVersions();
|
||||
|
||||
// 添加窗口拖动功能
|
||||
this.MouseDown += (sender, e) =>
|
||||
MouseDown += (sender, e) =>
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
this.DragMove();
|
||||
DragMove();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用当前主题设置
|
||||
/// </summary>
|
||||
private void ApplyCurrentTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 根据主窗口的主题设置应用主题
|
||||
switch (MainWindow.Settings.Appearance.Theme)
|
||||
{
|
||||
case 0: // 浅色主题
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
|
||||
UpdateColorsForLightTheme();
|
||||
break;
|
||||
case 1: // 深色主题
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
|
||||
UpdateColorsForDarkTheme();
|
||||
break;
|
||||
case 2: // 跟随系统
|
||||
if (IsSystemThemeLight())
|
||||
{
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
|
||||
UpdateColorsForLightTheme();
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
|
||||
UpdateColorsForDarkTheme();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"应用主题时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新为浅色主题颜色
|
||||
/// </summary>
|
||||
private void UpdateColorsForLightTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 更新主要颜色资源
|
||||
Resources["PrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x25, 0x63, 0xeb));
|
||||
Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x1f, 0x29, 0x37));
|
||||
Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x6b, 0x72, 0x80));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"更新浅色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新为深色主题颜色
|
||||
/// </summary>
|
||||
private void UpdateColorsForDarkTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 更新主要颜色资源
|
||||
Resources["PrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x3b, 0x82, 0xf6));
|
||||
Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0xf9, 0xfa, 0xfb));
|
||||
Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x9c, 0xa3, 0xaf));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"更新深色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查系统是否为浅色主题
|
||||
/// </summary>
|
||||
private bool IsSystemThemeLight()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"))
|
||||
{
|
||||
if (key?.GetValue("AppsUseLightTheme") is int value)
|
||||
{
|
||||
return value == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 如果无法读取注册表,默认返回true(浅色主题)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private async void LoadVersions()
|
||||
{
|
||||
@@ -146,12 +248,12 @@ namespace Ink_Canvas
|
||||
|
||||
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user