diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj index 49ae2656495..3fb0fa46f64 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -95,6 +95,7 @@ + diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs index 3182adfed65..1ee6b5c4551 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs @@ -1,12 +1,13 @@ using System.Windows; -using Flow.Launcher.Plugin.BrowserBookmark.Models; using System.Windows.Input; -using System.ComponentModel; using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; +using Flow.Launcher.Plugin.BrowserBookmark.Models; namespace Flow.Launcher.Plugin.BrowserBookmark.Views; -public partial class SettingsControl : INotifyPropertyChanged +[INotifyPropertyChanged] +public partial class SettingsControl { public Settings Settings { get; } public CustomBrowser SelectedCustomBrowser { get; set; } @@ -53,12 +54,10 @@ public bool OpenInNewBrowserWindow set { Settings.OpenInNewBrowserWindow = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OpenInNewBrowserWindow))); + OnPropertyChanged(); } } - public event PropertyChangedEventHandler PropertyChanged; - private void NewCustomBrowser(object sender, RoutedEventArgs e) { var newBrowser = new CustomBrowser(); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 7d0a553a486..2e0f6a67db3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -98,8 +98,11 @@ Delete Permanently delete current file Permanently delete current folder - Path: - Name: + Name + Type + Path + File + Folder Delete the selected Run as different user Run the selected using a different user account diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs index 745032d2c3d..2c4c4e54f9e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs @@ -1,16 +1,11 @@ -using System.ComponentModel; -using System.Runtime.CompilerServices; +#nullable enable -#nullable enable - -namespace Flow.Launcher.Plugin.Explorer.Views +namespace Flow.Launcher.Plugin.Explorer.ViewModels { - public class ActionKeywordModel : INotifyPropertyChanged + public partial class ActionKeywordModel : BaseModel { private static Settings _settings = null!; - public event PropertyChangedEventHandler? PropertyChanged; - public static void Init(Settings settings) { _settings = settings; @@ -28,13 +23,7 @@ internal ActionKeywordModel(Settings.ActionKeyword actionKeyword, string descrip internal Settings.ActionKeyword KeywordProperty { get; } - private void OnPropertyChanged([CallerMemberName] string propertyName = "") - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - private string? keyword; - public string Keyword { get => keyword ??= _settings.GetActionKeyword(KeywordProperty); @@ -45,8 +34,8 @@ public string Keyword OnPropertyChanged(); } } - private bool? enabled; + private bool? enabled; public bool Enabled { get => enabled ??= _settings.GetActionKeywordEnabled(KeywordProperty); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 10ce28fe4ed..829a2feedd3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -1,16 +1,13 @@ -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; +using System.Linq; using System.Windows; using System.Windows.Input; +using CommunityToolkit.Mvvm.ComponentModel; +using Flow.Launcher.Plugin.Explorer.ViewModels; namespace Flow.Launcher.Plugin.Explorer.Views { - /// - /// Interaction logic for ActionKeywordSetting.xaml - /// - public partial class ActionKeywordSetting : INotifyPropertyChanged + [INotifyPropertyChanged] + public partial class ActionKeywordSetting { private ActionKeywordModel CurrentActionKeyword { get; } @@ -21,14 +18,14 @@ public string ActionKeyword { // Set Enable to be true if user change ActionKeyword KeywordEnabled = true; - _ = SetField(ref actionKeyword, value); + _ = SetProperty(ref actionKeyword, value); } } public bool KeywordEnabled { get => _keywordEnabled; - set => SetField(ref _keywordEnabled, value); + set => _ = SetProperty(ref _keywordEnabled, value); } private string actionKeyword; @@ -116,20 +113,5 @@ private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e) e.CancelCommand(); } } - - 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)) - return false; - field = value; - OnPropertyChanged(propertyName); - return true; - } } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 8f4b4d8623e..59373b4de3f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -8,7 +8,6 @@ xmlns:qa="clr-namespace:Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks" xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Explorer.ViewModels" - xmlns:views="clr-namespace:Flow.Launcher.Plugin.Explorer.Views" d:DataContext="{d:DesignInstance viewModels:SettingsViewModel}" d:DesignHeight="450" d:DesignWidth="800" @@ -18,7 +17,7 @@ - + - - - + + + + @@ -58,55 +59,91 @@ - + + + + + + + + + + + + + + - - - + + + + + + + + - - + IsReadOnly="True" + Text="{Binding SelectedPath, Mode=TwoWay}" />