From 114c12bdaf694dd2b5f98fc59b14ff1d1b84c0ad Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 17 Jan 2021 18:47:19 +1100 Subject: [PATCH] formatting and description --- Flow.Launcher.Core/Plugin/PluginManager.cs | 2 +- Flow.Launcher.Plugin/IAsyncPlugin.cs | 4 ++++ Flow.Launcher.Plugin/IPlugin.cs | 4 ++-- Flow.Launcher.Plugin/Interfaces/IReloadable.cs | 2 +- Flow.Launcher/ViewModel/MainViewModel.cs | 9 +++++++-- .../Search/DirectoryInfo/DirectoryInfoSearch.cs | 1 - 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 5a5ba1971..26167e945 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -320,4 +320,4 @@ namespace Flow.Launcher.Core.Plugin } } } -} \ No newline at end of file +} diff --git a/Flow.Launcher.Plugin/IAsyncPlugin.cs b/Flow.Launcher.Plugin/IAsyncPlugin.cs index 3e1a086bc..c6f11aead 100644 --- a/Flow.Launcher.Plugin/IAsyncPlugin.cs +++ b/Flow.Launcher.Plugin/IAsyncPlugin.cs @@ -12,6 +12,10 @@ namespace Flow.Launcher.Plugin /// /// Asynchronous Querying /// + /// + /// If the Querying or Init method requires high IO transmission + /// or performing CPU intense jobs (performing better with cancellation), please use this IAsyncPlugin interface + /// /// Query to search /// Cancel when querying job is obsolete /// diff --git a/Flow.Launcher.Plugin/IPlugin.cs b/Flow.Launcher.Plugin/IPlugin.cs index 41c61a608..208f3021b 100644 --- a/Flow.Launcher.Plugin/IPlugin.cs +++ b/Flow.Launcher.Plugin/IPlugin.cs @@ -5,8 +5,8 @@ namespace Flow.Launcher.Plugin /// /// Synchronous Plugin Model for Flow Launcher /// - /// If you assume that Querying or Init method require IO transmission - /// or CPU Intense Job (performing better with cancellation), please try IAsyncPlugin interface + /// If the Querying or Init method requires high IO transmission + /// or performaing CPU intense jobs (performing better with cancellation), please try the IAsyncPlugin interface /// /// public interface IPlugin diff --git a/Flow.Launcher.Plugin/Interfaces/IReloadable.cs b/Flow.Launcher.Plugin/Interfaces/IReloadable.cs index d9160b0ea..31611519c 100644 --- a/Flow.Launcher.Plugin/Interfaces/IReloadable.cs +++ b/Flow.Launcher.Plugin/Interfaces/IReloadable.cs @@ -12,7 +12,7 @@ /// it will call the plugins that have implemented this interface. /// /// - /// If requiring reloading data asynchrouly, please try IAsyncReloadable + /// If requiring reloading data asynchronously, please use the IAsyncReloadable interface /// /// public interface IReloadable diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index bcb257204..a062f59dc 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -408,8 +408,13 @@ namespace Flow.Launcher.ViewModel for (var i = 0; i < plugins.Count; i++) { if (!plugins[i].Metadata.Disabled) + { tasks[i] = QueryTask(plugins[i], query, currentCancellationToken); - else tasks[i] = Task.CompletedTask; // Avoid Null + } + else + { + tasks[i] = Task.CompletedTask; // Avoid Null + } } // Check the code, WhenAll will translate all type of IEnumerable or Collection to Array, so make an array at first @@ -429,7 +434,7 @@ namespace Flow.Launcher.ViewModel ProgressBarVisibility = Visibility.Hidden; } - // Local Function + // Local function async Task QueryTask(PluginPair plugin, Query query, CancellationToken token) { // Since it is wrapped within a Task.Run, the synchronous context is null diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs index 3253b7a7b..88d7d6927 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Windows; namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo {