From e0721aae1464ba54a2c8fb2591cb7fd15660bc61 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 29 Mar 2025 22:03:30 +0800 Subject: [PATCH] Add new interfaces --- .../Interfaces/IAsyncEmptyQuery.cs | 23 +++++++++++++++ .../Interfaces/IEmptyQuery.cs | 28 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Flow.Launcher.Plugin/Interfaces/IAsyncEmptyQuery.cs create mode 100644 Flow.Launcher.Plugin/Interfaces/IEmptyQuery.cs diff --git a/Flow.Launcher.Plugin/Interfaces/IAsyncEmptyQuery.cs b/Flow.Launcher.Plugin/Interfaces/IAsyncEmptyQuery.cs new file mode 100644 index 000000000..a18f0848d --- /dev/null +++ b/Flow.Launcher.Plugin/Interfaces/IAsyncEmptyQuery.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Flow.Launcher.Plugin +{ + /// + /// Asynchronous Query Model for Flow Launcher When Query Text is Empty + /// + public interface IAsyncEmptyQuery + { + /// + /// Asynchronous Querying When Query Text is Empty + /// + /// + /// If the Querying method requires high IO transmission + /// or performing CPU intense jobs (performing better with cancellation), please use this IAsyncEmptyQuery interface + /// + /// Cancel when querying job is obsolete + /// + Task> EmptyQueryAsync(CancellationToken token); + } +} diff --git a/Flow.Launcher.Plugin/Interfaces/IEmptyQuery.cs b/Flow.Launcher.Plugin/Interfaces/IEmptyQuery.cs new file mode 100644 index 000000000..4ebdcf1fd --- /dev/null +++ b/Flow.Launcher.Plugin/Interfaces/IEmptyQuery.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Flow.Launcher.Plugin +{ + /// + /// Synchronous Query Model for Flow Launcher When Query Text is Empty + /// + /// If the Querying method requires high IO transmission + /// or performaing CPU intense jobs (performing better with cancellation), please try the IAsyncEmptyQuery interface + /// + /// + public interface IEmptyQuery : IAsyncEmptyQuery + { + /// + /// Querying When Query Text is Empty + /// + /// This method will be called within a Task.Run, + /// so please avoid synchrously wait for long. + /// + /// + /// + List EmptyQuery(); + + Task> IAsyncEmptyQuery.EmptyQueryAsync(CancellationToken token) => Task.Run(EmptyQuery); + } +}