Files
community/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs
T

74 lines
2.2 KiB
C#
Raw Normal View History

2026-02-21 16:51:34 +08:00
using Ink_Canvas.Helpers;
2025-10-05 09:33:25 +08:00
using iNKORE.UI.WPF.Modern;
using System;
2025-10-06 18:29:12 +08:00
using System.Windows;
using System.Windows.Input;
2025-05-25 09:29:48 +08:00
namespace Ink_Canvas
{
/// <summary>
/// Interaction logic for StopwatchWindow.xaml
/// </summary>
public partial class OperatingGuideWindow : Window
{
public OperatingGuideWindow()
{
InitializeComponent();
2026-04-05 21:35:43 +08:00
RefreshTheme();
2025-05-25 09:29:48 +08:00
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
}
2025-09-07 13:30:46 +08:00
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
{
2025-05-25 09:29:48 +08:00
e.Handled = true;
}
2025-10-05 09:33:25 +08:00
/// <summary>
/// 刷新主题
/// </summary>
public void RefreshTheme()
{
try
{
// 根据当前主题设置窗口主题
2025-10-06 18:29:12 +08:00
bool isDarkTheme = MainWindow.Settings.Appearance.Theme == 1 ||
2025-10-05 09:33:25 +08:00
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
2025-10-06 18:29:12 +08:00
2025-10-05 09:33:25 +08:00
if (isDarkTheme)
{
ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
}
else
{
ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
}
// 强制刷新UI
InvalidateVisual();
}
catch (Exception)
{
}
}
/// <summary>
/// 检查系统主题是否为浅色
/// </summary>
private bool IsSystemThemeLight()
{
var light = false;
try
{
var registryKey = Microsoft.Win32.Registry.CurrentUser;
var themeKey =
registryKey.OpenSubKey("software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
var keyValue = 0;
if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme");
if (keyValue == 1) light = true;
}
2026-02-21 16:51:34 +08:00
catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); }
2025-10-05 09:33:25 +08:00
return light;
}
2025-05-25 09:29:48 +08:00
}
}