using Ink_Canvas.Helpers; using iNKORE.UI.WPF.Modern; using iNKORE.UI.WPF.Modern.Common.IconKeys; 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(); AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25); } private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e) { Close(); } private void WindowDragMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) DragMove(); } private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e) { if (WindowState == WindowState.Normal) { WindowState = WindowState.Maximized; FontIconFullscreen.Icon = SegoeFluentIcons.BackToWindow; } else { WindowState = WindowState.Normal; FontIconFullscreen.Icon = SegoeFluentIcons.FullScreen; } } 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; } } }