improve:UI
This commit is contained in:
@@ -3,130 +3,164 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Ink_Canvas"
|
|
||||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
FontFamily="Microsoft YaHei UI"
|
Title="隐私说明 - InkCanvasForClass"
|
||||||
|
Height="640" Width="720"
|
||||||
|
MinHeight="420" MinWidth="520"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Topmost="True"
|
Topmost="True"
|
||||||
Title="隐私说明 - Ink Canvas" Height="600" Width="600"
|
|
||||||
ui:ThemeManager.IsThemeAware="True"
|
ui:ThemeManager.IsThemeAware="True"
|
||||||
ui:TitleBar.ExtendViewIntoTitleBar="True"
|
ui:TitleBar.ExtendViewIntoTitleBar="True"
|
||||||
ui:WindowHelper.SystemBackdropType="Mica"
|
ui:WindowHelper.SystemBackdropType="Mica"
|
||||||
ui:WindowHelper.UseModernWindowStyle="True"
|
ui:WindowHelper.UseModernWindowStyle="True"
|
||||||
ui:TitleBar.Height="48"
|
ui:TitleBar.Height="48"
|
||||||
Loaded="Window_Loaded" Closing="Window_Closing">
|
Loaded="Window_Loaded" Closing="Window_Closing">
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowBackground" Color="White"/>
|
<ResourceDictionary>
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowForeground" Color="Black"/>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowButtonBackground" Color="#F4F4F5"/>
|
<ui:ThemeResources CanBeAccessedAcrossThreads="True">
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowButtonForeground" Color="Black"/>
|
<ui:ThemeResources.ThemeDictionaries />
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowBorderBrush" Color="#E4E4E7"/>
|
</ui:ThemeResources>
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowButtonAcceptBackground" Color="#3584e4"/>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<SolidColorBrush x:Key="PrivacyAgreementWindowButtonAcceptForeground" Color="White"/>
|
</ResourceDictionary>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- 自定义标题栏 -->
|
<!-- 标题栏 -->
|
||||||
<Border x:Name="Border_TitleBarRoot"
|
<Border Grid.Row="0"
|
||||||
Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=(ui:TitleBar.Height)}">
|
Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=(ui:TitleBar.Height)}"
|
||||||
|
Background="Transparent">
|
||||||
|
<ikw:SimpleStackPanel Orientation="Horizontal"
|
||||||
|
Spacing="12"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Margin="16,0,0,0">
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Shield}" FontSize="14" />
|
||||||
|
<TextBlock VerticalAlignment="Center"
|
||||||
|
Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=Title}"
|
||||||
|
TextWrapping="NoWrap" />
|
||||||
|
</ikw:SimpleStackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Banner Header -->
|
||||||
|
<Border Grid.Row="1"
|
||||||
|
Padding="40,18,40,18"
|
||||||
|
BorderThickness="0,0,0,1"
|
||||||
|
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||||
|
<GradientStop Color="#1F3B82F6" Offset="0" />
|
||||||
|
<GradientStop Color="#0A8B5CF6" Offset="1" />
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=Title}"
|
<Border Grid.Column="0" Grid.RowSpan="2"
|
||||||
VerticalAlignment="Center" Margin="12,0,0,0" FontSize="12" FontWeight="SemiBold"/>
|
Width="48" Height="48"
|
||||||
|
Margin="0,0,16,0"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
CornerRadius="10"
|
||||||
|
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Shield}"
|
||||||
|
FontSize="24"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!--Right Inset-->
|
<TextBlock Grid.Column="1" Grid.Row="0"
|
||||||
<Rectangle Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=(ui:TitleBar.SystemOverlayRightInset)}"
|
Style="{DynamicResource TitleTextBlockStyle}"
|
||||||
Grid.Column="2"/>
|
Text="隐私说明" />
|
||||||
|
<TextBlock Grid.Column="1" Grid.Row="1"
|
||||||
<!--Right Buttons-->
|
Style="{DynamicResource BodyTextBlockStyle}"
|
||||||
<ikw:SimpleStackPanel x:Name="StackPanel_RightButtons"
|
Margin="0,4,0,0"
|
||||||
Orientation="Horizontal" Grid.Column="1" Spacing="5">
|
Opacity="0.85"
|
||||||
</ikw:SimpleStackPanel>
|
TextWrapping="Wrap"
|
||||||
|
Text="请仔细阅读以下条款。点击"同意"即表示您理解并接受本软件的隐私实践。" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- 主内容区 -->
|
|
||||||
<Grid Grid.Row="1" Background="{DynamicResource PrivacyAgreementWindowBackground}">
|
|
||||||
<ScrollViewer Margin="10,10,10,70"
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
HorizontalScrollBarVisibility="Disabled">
|
|
||||||
<TextBox Name="TextBoxPrivacyContent"
|
|
||||||
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
IsReadOnly="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
Background="{DynamicResource PrivacyAgreementWindowBackground}"
|
|
||||||
Foreground="{DynamicResource PrivacyAgreementWindowForeground}"
|
|
||||||
BorderBrush="{DynamicResource PrivacyAgreementWindowBorderBrush}"
|
|
||||||
Padding="10"/>
|
|
||||||
</ScrollViewer>
|
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
Margin="10">
|
|
||||||
<Button Name="ButtonCancel"
|
|
||||||
Margin="0,0,10,0"
|
|
||||||
Content="取消"
|
|
||||||
|
|
||||||
Width="100"
|
|
||||||
Height="35"
|
|
||||||
Click="ButtonCancel_Click"
|
|
||||||
Background="{DynamicResource PrivacyAgreementWindowButtonBackground}"
|
|
||||||
Foreground="{DynamicResource PrivacyAgreementWindowButtonForeground}"
|
|
||||||
BorderBrush="{DynamicResource PrivacyAgreementWindowBorderBrush}"
|
|
||||||
OverridesDefaultStyle="True">
|
|
||||||
<Button.Template>
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Border Background="{TemplateBinding Background}"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
|
||||||
CornerRadius="4">
|
|
||||||
<ContentPresenter HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Margin="{TemplateBinding Padding}"
|
|
||||||
RecognizesAccessKey="True"/>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Button.Template>
|
|
||||||
</Button>
|
|
||||||
<Button Name="ButtonAccept"
|
|
||||||
Content="同意"
|
|
||||||
|
|
||||||
Width="100"
|
|
||||||
Height="35"
|
|
||||||
Click="ButtonAccept_Click"
|
|
||||||
Background="{DynamicResource PrivacyAgreementWindowButtonAcceptBackground}"
|
|
||||||
Foreground="{DynamicResource PrivacyAgreementWindowButtonAcceptForeground}"
|
|
||||||
BorderBrush="{DynamicResource PrivacyAgreementWindowBorderBrush}"
|
|
||||||
OverridesDefaultStyle="True">
|
|
||||||
<Button.Template>
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Border Background="{TemplateBinding Background}"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
|
||||||
CornerRadius="4">
|
|
||||||
<ContentPresenter HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Margin="{TemplateBinding Padding}"
|
|
||||||
RecognizesAccessKey="True"/>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Button.Template>
|
|
||||||
</Button>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
|
|
||||||
|
<!-- 内容区 -->
|
||||||
|
<ScrollViewer Grid.Row="2"
|
||||||
|
x:Name="ContentScroll"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
PanningMode="VerticalFirst"
|
||||||
|
Padding="40,16,40,16">
|
||||||
|
<Border Background="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}"
|
||||||
|
CornerRadius="8"
|
||||||
|
Padding="20,16"
|
||||||
|
BorderThickness="1"
|
||||||
|
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}">
|
||||||
|
<TextBlock Name="TextBoxPrivacyContent"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
LineHeight="22"
|
||||||
|
FontSize="13"
|
||||||
|
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" />
|
||||||
|
</Border>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<Border Grid.Row="3"
|
||||||
|
Padding="40,12,40,16"
|
||||||
|
BorderThickness="0,1,0,0"
|
||||||
|
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{DynamicResource CaptionTextBlockStyle}"
|
||||||
|
Opacity="0.7"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Text="本软件不会收集课堂内容或可识别的个人信息。" />
|
||||||
|
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Name="ButtonCancel"
|
||||||
|
MinWidth="96"
|
||||||
|
Height="32"
|
||||||
|
Margin="0,0,8,0"
|
||||||
|
Click="ButtonCancel_Click">
|
||||||
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="6">
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Cancel}" FontSize="12" />
|
||||||
|
<TextBlock Text="取消" />
|
||||||
|
</ikw:SimpleStackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
Name="ButtonAccept"
|
||||||
|
MinWidth="120"
|
||||||
|
Height="32"
|
||||||
|
IsDefault="True"
|
||||||
|
Style="{DynamicResource AccentButtonStyle}"
|
||||||
|
Click="ButtonAccept_Click">
|
||||||
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="6">
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Accept}" FontSize="12" />
|
||||||
|
<TextBlock Text="同意" />
|
||||||
|
</ikw:SimpleStackPanel>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -6,7 +6,6 @@ using System.Reflection;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace Ink_Canvas
|
namespace Ink_Canvas
|
||||||
@@ -18,7 +17,7 @@ namespace Ink_Canvas
|
|||||||
public PrivacyAgreementWindow()
|
public PrivacyAgreementWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Topmost = true;
|
Topmost = true;
|
||||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
||||||
ApplyTheme();
|
ApplyTheme();
|
||||||
}
|
}
|
||||||
@@ -27,13 +26,13 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.Topmost = true;
|
Topmost = true;
|
||||||
|
|
||||||
Dispatcher.BeginInvoke(new Action(() =>
|
Dispatcher.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
this.Activate();
|
Activate();
|
||||||
this.Focus();
|
Focus();
|
||||||
this.Topmost = true;
|
Topmost = true;
|
||||||
SetForegroundWindow(new WindowInteropHelper(this).Handle);
|
SetForegroundWindow(new WindowInteropHelper(this).Handle);
|
||||||
}), DispatcherPriority.Loaded);
|
}), DispatcherPriority.Loaded);
|
||||||
|
|
||||||
@@ -76,9 +75,7 @@ namespace Ink_Canvas
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||||
|
|
||||||
private void Window_Closing(object sender, CancelEventArgs e)
|
private void Window_Closing(object sender, CancelEventArgs e) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
|
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -98,10 +95,19 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (MainWindow.Settings != null)
|
var settings = MainWindow.Settings;
|
||||||
|
if (settings == null) return;
|
||||||
|
|
||||||
|
iNKORE.UI.WPF.Modern.ElementTheme target;
|
||||||
|
switch (settings.Appearance.Theme)
|
||||||
{
|
{
|
||||||
ApplyTheme(MainWindow.Settings);
|
case 0: target = iNKORE.UI.WPF.Modern.ElementTheme.Light; break;
|
||||||
|
case 1: target = iNKORE.UI.WPF.Modern.ElementTheme.Dark; break;
|
||||||
|
default: target = IsSystemThemeLight()
|
||||||
|
? iNKORE.UI.WPF.Modern.ElementTheme.Light
|
||||||
|
: iNKORE.UI.WPF.Modern.ElementTheme.Dark; break;
|
||||||
}
|
}
|
||||||
|
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, target);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -109,97 +115,19 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyTheme(Settings settings)
|
private static bool IsSystemThemeLight()
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
if (settings.Appearance.Theme == 0)
|
|
||||||
{
|
|
||||||
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light);
|
|
||||||
ApplyThemeResources("Light");
|
|
||||||
}
|
|
||||||
else if (settings.Appearance.Theme == 1)
|
|
||||||
{
|
|
||||||
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark);
|
|
||||||
ApplyThemeResources("Dark");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bool isSystemLight = IsSystemThemeLight();
|
|
||||||
if (isSystemLight)
|
|
||||||
{
|
|
||||||
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light);
|
|
||||||
ApplyThemeResources("Light");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark);
|
|
||||||
ApplyThemeResources("Dark");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LogHelper.WriteLogToFile($"应用隐私说明窗口主题出错: {ex.Message}", LogHelper.LogType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyThemeResources(string theme)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var resources = this.Resources;
|
|
||||||
|
|
||||||
if (theme == "Light")
|
|
||||||
{
|
|
||||||
resources["PrivacyAgreementWindowBackground"] = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
|
||||||
resources["PrivacyAgreementWindowForeground"] = new SolidColorBrush(Color.FromRgb(24, 24, 27));
|
|
||||||
resources["PrivacyAgreementWindowButtonBackground"] = new SolidColorBrush(Color.FromRgb(244, 244, 245));
|
|
||||||
resources["PrivacyAgreementWindowButtonForeground"] = new SolidColorBrush(Color.FromRgb(24, 24, 27));
|
|
||||||
resources["PrivacyAgreementWindowBorderBrush"] = new SolidColorBrush(Color.FromRgb(228, 228, 231));
|
|
||||||
resources["PrivacyAgreementWindowButtonAcceptBackground"] = new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
|
||||||
resources["PrivacyAgreementWindowButtonAcceptForeground"] = new SolidColorBrush(Colors.White);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resources["PrivacyAgreementWindowBackground"] = new SolidColorBrush(Color.FromRgb(31, 31, 31));
|
|
||||||
resources["PrivacyAgreementWindowForeground"] = new SolidColorBrush(Colors.White);
|
|
||||||
resources["PrivacyAgreementWindowButtonBackground"] = new SolidColorBrush(Color.FromRgb(42, 42, 42));
|
|
||||||
resources["PrivacyAgreementWindowButtonForeground"] = new SolidColorBrush(Colors.White);
|
|
||||||
resources["PrivacyAgreementWindowBorderBrush"] = new SolidColorBrush(Color.FromRgb(224, 224, 224));
|
|
||||||
resources["PrivacyAgreementWindowButtonAcceptBackground"] = new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
|
||||||
resources["PrivacyAgreementWindowButtonAcceptForeground"] = new SolidColorBrush(Colors.White);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LogHelper.WriteLogToFile($"应用隐私说明窗口主题资源出错: {ex.Message}", LogHelper.LogType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsSystemThemeLight()
|
|
||||||
{
|
|
||||||
var light = false;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
||||||
var themeKey = registryKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
using (var themeKey = registryKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"))
|
||||||
if (themeKey != null)
|
|
||||||
{
|
{
|
||||||
var value = themeKey.GetValue("AppsUseLightTheme");
|
var value = themeKey?.GetValue("AppsUseLightTheme");
|
||||||
if (value != null)
|
if (value is int i) return i == 1;
|
||||||
{
|
|
||||||
light = (int)value == 1;
|
|
||||||
}
|
|
||||||
themeKey.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch { }
|
||||||
{
|
return true;
|
||||||
light = true;
|
|
||||||
}
|
|
||||||
return light;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user