using Ink_Canvas.Helpers; using iNKORE.UI.WPF.Modern; using System; using System.Windows; using System.Windows.Input; namespace Ink_Canvas { /// /// Interaction logic for StopwatchWindow.xaml /// public partial class OperatingGuideWindow : Window { public OperatingGuideWindow() { InitializeComponent(); RefreshTheme(); AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25); } private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) { e.Handled = true; } /// /// 刷新主题 /// public void RefreshTheme() { try { // 根据当前主题设置窗口主题 bool isDarkTheme = MainWindow.Settings.Appearance.Theme == 1 || (MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()); if (isDarkTheme) { ThemeManager.SetRequestedTheme(this, ElementTheme.Dark); } else { ThemeManager.SetRequestedTheme(this, ElementTheme.Light); } // 强制刷新UI InvalidateVisual(); } catch (Exception) { } } /// /// 检查系统主题是否为浅色 /// 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; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return light; } } }