From d9d92c61ce09aab52d8b38c53069246511ec8e60 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 13 Mar 2025 15:05:41 +0800 Subject: [PATCH] Clean up codes --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 + Flow.Launcher/MainWindow.xaml | 6 +++--- .../ViewModels/SettingsPaneGeneralViewModel.cs | 7 ------- Flow.Launcher/SettingWindow.xaml.cs | 7 ------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 93f6db111..505eb4d3c 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -297,6 +297,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings [JsonIgnore] public bool WMPInstalled { get; set; } = true; + public bool SelectAllQueryOnReopen { get; set; } = true; // This needs to be loaded last by staying at the bottom public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 550f5c8a1..23c2e771c 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -20,7 +20,6 @@ Closing="OnClosing" Deactivated="OnDeactivated" Icon="Images/app.png" - SourceInitialized="OnSourceInitialized" Initialized="OnInitialized" Left="{Binding Settings.WindowLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Loaded="OnLoaded" @@ -31,6 +30,7 @@ ResizeMode="CanResize" ShowInTaskbar="False" SizeToContent="Height" + SourceInitialized="OnSourceInitialized" Topmost="True" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WindowStartupLocation="Manual" @@ -240,13 +240,13 @@ FontSize="{Binding QueryBoxFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}" InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}" + Loaded="SelectAllQueryText" PreviewDragOver="OnPreviewDragOver" PreviewKeyUp="QueryTextBox_KeyUp" Style="{DynamicResource QueryBoxStyle}" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="Visible" - WindowChrome.IsHitTestVisibleInChrome="True" - Loaded="SelectAllQueryText"> + WindowChrome.IsHitTestVisibleInChrome="True"> diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index 5bc59679c..fc2e8a607 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -24,7 +24,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel _updater = updater; _portable = portable; UpdateEnumDropdownLocalizations(); - SelectAllQueryOnReopen = settings.SelectAllQueryOnReopen; // Pfa33 } public class SearchWindowScreenData : DropdownDataGeneric { } @@ -65,12 +64,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } } - public bool SelectAllQueryOnReopen - { - get => Settings.SelectAllQueryOnReopen; - set => Settings.SelectAllQueryOnReopen = value; - } - public bool UseLogonTaskForStartup { get => Settings.UseLogonTaskForStartup; diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index d1a22c65d..f87194c30 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -47,13 +47,6 @@ public partial class SettingWindow hwndTarget.RenderMode = RenderMode.SoftwareOnly; // Must use software only render mode here InitializePosition(); - - // Initialize the new checkbox based on the settings - var selectAllQueryOnReopenCheckbox = (System.Windows.Controls.CheckBox)FindName("SelectAllQueryOnReopenCheckbox"); - if (selectAllQueryOnReopenCheckbox != null) - { - selectAllQueryOnReopenCheckbox.IsChecked = _settings.SelectAllQueryOnReopen; - } } private void OnClosed(object sender, EventArgs e)