From 1e603ea20f800704b939ccf1941a8d14d8274f73 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 15 Apr 2025 13:21:00 +0800 Subject: [PATCH] Code quality --- .../Helper/SortOptionTranslationHelper.cs | 2 +- .../Views/ActionKeywordSetting.xaml.cs | 3 +++ .../Views/ExplorerSettings.xaml.cs | 12 +++--------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/SortOptionTranslationHelper.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/SortOptionTranslationHelper.cs index 0a3a2ae43..72f58f5b6 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/SortOptionTranslationHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/SortOptionTranslationHelper.cs @@ -16,7 +16,7 @@ public static class SortOptionTranslationHelper ArgumentNullException.ThrowIfNull(API); var enumName = Enum.GetName(sortOption); - var splited = enumName.Split('_'); + var splited = enumName!.Split('_'); var name = string.Join('_', splited[..^1]); var direction = splited[^1]; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 73c35b1c8..000b2558d 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -85,6 +85,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views DialogResult = false; Close(); } + private void TxtCurrentActionKeyword_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) @@ -94,11 +95,13 @@ namespace Flow.Launcher.Plugin.Explorer.Views e.Handled = true; } } + public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + private bool SetField(ref T field, T value, [CallerMemberName] string propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index b7f5efc3c..9203ece9a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -1,11 +1,10 @@ -using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; -using Flow.Launcher.Plugin.Explorer.ViewModels; -using System.Collections.Generic; -using System.ComponentModel; +using System.ComponentModel; using System.IO; using System.Linq; using System.Windows; using System.Windows.Controls; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; +using Flow.Launcher.Plugin.Explorer.ViewModels; using DataFormats = System.Windows.DataFormats; using DragDropEffects = System.Windows.DragDropEffects; using DragEventArgs = System.Windows.DragEventArgs; @@ -19,9 +18,6 @@ namespace Flow.Launcher.Plugin.Explorer.Views { private readonly SettingsViewModel viewModel; - private List actionKeywordsListView; - - public ExplorerSettings(SettingsViewModel viewModel) { DataContext = viewModel; @@ -39,8 +35,6 @@ namespace Flow.Launcher.Plugin.Explorer.Views lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending)); } - - private void AccessLinkDragDrop(string containerName, DragEventArgs e) { var files = (string[])e.Data.GetData(DataFormats.FileDrop);