mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add new interfaces
This commit is contained in:
parent
9005c93c2f
commit
e0721aae14
2 changed files with 51 additions and 0 deletions
23
Flow.Launcher.Plugin/Interfaces/IAsyncEmptyQuery.cs
Normal file
23
Flow.Launcher.Plugin/Interfaces/IAsyncEmptyQuery.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronous Query Model for Flow Launcher When Query Text is Empty
|
||||
/// </summary>
|
||||
public interface IAsyncEmptyQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronous Querying When Query Text is Empty
|
||||
/// </summary>
|
||||
/// <para>
|
||||
/// If the Querying method requires high IO transmission
|
||||
/// or performing CPU intense jobs (performing better with cancellation), please use this IAsyncEmptyQuery interface
|
||||
/// </para>
|
||||
/// <param name="token">Cancel when querying job is obsolete</param>
|
||||
/// <returns></returns>
|
||||
Task<List<Result>> EmptyQueryAsync(CancellationToken token);
|
||||
}
|
||||
}
|
||||
28
Flow.Launcher.Plugin/Interfaces/IEmptyQuery.cs
Normal file
28
Flow.Launcher.Plugin/Interfaces/IEmptyQuery.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Synchronous Query Model for Flow Launcher When Query Text is Empty
|
||||
/// <para>
|
||||
/// If the Querying method requires high IO transmission
|
||||
/// or performaing CPU intense jobs (performing better with cancellation), please try the IAsyncEmptyQuery interface
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public interface IEmptyQuery : IAsyncEmptyQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Querying When Query Text is Empty
|
||||
/// <para>
|
||||
/// This method will be called within a Task.Run,
|
||||
/// so please avoid synchrously wait for long.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<Result> EmptyQuery();
|
||||
|
||||
Task<List<Result>> IAsyncEmptyQuery.EmptyQueryAsync(CancellationToken token) => Task.Run(EmptyQuery);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue