diff --git a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj index 67c76d006..c808052b0 100644 --- a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj +++ b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj @@ -60,8 +60,13 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index 4a2368347..fbb451781 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -44,7 +44,7 @@ namespace Flow.Launcher var oldActionKeyword = plugin.Metadata.ActionKeywords[0]; var newActionKeyword = tbAction.Text.Trim(); newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*"; - if (!pluginViewModel.IsActionKeywordRegistered(newActionKeyword)) + if (!PluginViewModel.IsActionKeywordRegistered(newActionKeyword)) { pluginViewModel.ChangeActionKeyword(newActionKeyword, oldActionKeyword); Close(); diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index edf41e193..fd2f5f1d9 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -83,6 +83,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 0caf8aa64..6a03663f2 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -9,31 +9,32 @@ namespace Flow.Launcher.ViewModel { public class PluginViewModel : BaseModel { - public PluginPair PluginPair { get; set; } + private readonly PluginPair _pluginPair; + public PluginPair PluginPair + { + get => _pluginPair; + init + { + _pluginPair = value; + value.Metadata.PropertyChanged += (_, args) => + { + if (args.PropertyName == nameof(PluginPair.Metadata.AvgQueryTime)) + OnPropertyChanged(nameof(QueryTime)); + }; + } + } public ImageSource Image => ImageLoader.Load(PluginPair.Metadata.IcoPath); public bool PluginState { - get { return !PluginPair.Metadata.Disabled; } - set - { - PluginPair.Metadata.Disabled = !value; - } + get => !PluginPair.Metadata.Disabled; + set => PluginPair.Metadata.Disabled = !value; } - public Control SettingControl - { - get - { - if (PluginPair.Plugin is not ISettingProvider settingProvider) - return new Control(); - - return settingProvider.CreateSettingPanel(); - } - } + public Control SettingControl => PluginPair.Plugin is not ISettingProvider settingProvider ? new Control() : settingProvider.CreateSettingPanel(); public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed; - public string InitilizaTime => PluginPair.Metadata.InitTime.ToString() + "ms"; + public string InitilizaTime => PluginPair.Metadata.InitTime + "ms"; public string QueryTime => PluginPair.Metadata.AvgQueryTime + "ms"; public string ActionKeywordsText => string.Join(Query.ActionKeywordSeperater, PluginPair.Metadata.ActionKeywords); public int Priority => PluginPair.Metadata.Priority; @@ -41,7 +42,6 @@ namespace Flow.Launcher.ViewModel public void ChangeActionKeyword(string newActionKeyword, string oldActionKeyword) { PluginManager.ReplaceActionKeyword(PluginPair.Metadata.ID, oldActionKeyword, newActionKeyword); - OnPropertyChanged(nameof(ActionKeywordsText)); } @@ -51,6 +51,7 @@ namespace Flow.Launcher.ViewModel OnPropertyChanged(nameof(Priority)); } - public bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword); + public static bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword); } -} + +} \ No newline at end of file