From 29c6f12cc5035932925cb0e9b47ee80e8a601562 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 16 Mar 2025 13:44:13 +0800 Subject: [PATCH] Code cleanup --- Flow.Launcher.Infrastructure/Win32Helper.cs | 9 ++++++++- Flow.Launcher/MainWindow.xaml.cs | 9 --------- .../ViewModels/SettingsPaneThemeViewModel.cs | 9 +-------- Flow.Launcher/ViewModel/MainViewModel.cs | 12 ------------ 4 files changed, 9 insertions(+), 30 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Win32Helper.cs b/Flow.Launcher.Infrastructure/Win32Helper.cs index 72320cba7..c48c23518 100644 --- a/Flow.Launcher.Infrastructure/Win32Helper.cs +++ b/Flow.Launcher.Infrastructure/Win32Helper.cs @@ -9,7 +9,14 @@ namespace Flow.Launcher.Infrastructure { public static class Win32Helper { - #region Mica + #region Backdrop + + public static bool IsBackdropSupported() + { + // Windows 11 (22000) 이상에서만 Mica 및 Acrylic 효과 지원 + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + Environment.OSVersion.Version.Build >= 22000; + } public static unsafe bool SetMicaForWindow(Window window, bool enableMica) { diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index abdb3501c..d191298de 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -27,8 +27,6 @@ using DataObject = System.Windows.DataObject; using System.Windows.Media; using System.Windows.Interop; using Windows.Win32; -using Microsoft.VisualBasic.Devices; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; using Window = System.Windows.Window; namespace Flow.Launcher @@ -749,13 +747,6 @@ namespace Flow.Launcher } } - - - - - - - private void InitSoundEffects() { if (_settings.WMPInstalled) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 2e27a0eb7..035635774 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -15,7 +15,6 @@ using Flow.Launcher.ViewModel; using ModernWpf; using ThemeManager = Flow.Launcher.Core.Resource.ThemeManager; using ThemeManagerForColorSchemeSwitch = ModernWpf.ThemeManager; -using System.Runtime.InteropServices; namespace Flow.Launcher.SettingPages.ViewModels; @@ -61,17 +60,11 @@ public partial class SettingsPaneThemeViewModel : BaseModel { get { - if (!IsBackdropSupported()) return false; + if (!Win32Helper.IsBackdropSupported()) return false; return SelectedTheme?.HasBlur ?? false; } } - private bool IsBackdropSupported() - { - // Windows 11 (22000) 이상에서만 Mica 및 Acrylic 효과 지원 - return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && - Environment.OSVersion.Version.Build >= 22000; - } public bool IsDropShadowEnabled => !ThemeManager.Instance.BlurEnabled; public bool DropShadowEffect diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index d3029d81b..8f9671a9e 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -27,7 +27,6 @@ using Flow.Launcher.Infrastructure.Image; using System.Windows.Media; using CommunityToolkit.Mvvm.DependencyInjection; using System.Windows.Threading; -using System.Runtime.InteropServices; using System.Windows.Interop; namespace Flow.Launcher.ViewModel @@ -1383,17 +1382,6 @@ namespace Flow.Launcher.ViewModel } } - // DWM 관련 상수 - private const int DWMWA_CLOAK = 14; - private const int SW_HIDE = 0; - private const int SW_SHOW = 5; - - [DllImport("user32.dll")] - private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); - - [DllImport("dwmapi.dll")] - private static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref int pvAttribute, int cbAttribute); - public void Show() { Application.Current.Dispatcher.Invoke(() =>