2013-12-19 15:51:20 +00:00
|
|
|
|
using System.Collections.Generic;
|
2021-03-23 09:25:46 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2013-12-19 15:51:20 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin
|
2014-05-25 10:11:27 +00:00
|
|
|
|
{
|
2021-01-14 04:24:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Synchronous Plugin Model for Flow Launcher
|
|
|
|
|
|
/// <para>
|
2021-01-17 07:47:19 +00:00
|
|
|
|
/// If the Querying or Init method requires high IO transmission
|
|
|
|
|
|
/// or performaing CPU intense jobs (performing better with cancellation), please try the IAsyncPlugin interface
|
2021-01-14 04:24:41 +00:00
|
|
|
|
/// </para>
|
|
|
|
|
|
/// </summary>
|
2021-03-23 09:25:46 +00:00
|
|
|
|
public interface IPlugin : IAsyncPlugin
|
2014-05-25 10:11:27 +00:00
|
|
|
|
{
|
2021-01-14 04:24:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Querying when user's search changes
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// This method will be called within a Task.Run,
|
|
|
|
|
|
/// so please avoid synchrously wait for long.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="query">Query to search</param>
|
|
|
|
|
|
/// <returns></returns>
|
2014-05-25 10:11:27 +00:00
|
|
|
|
List<Result> Query(Query query);
|
2021-01-14 04:24:41 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initialize plugin
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="context"></param>
|
2014-05-25 10:11:27 +00:00
|
|
|
|
void Init(PluginInitContext context);
|
2021-03-23 09:25:46 +00:00
|
|
|
|
|
|
|
|
|
|
Task IAsyncPlugin.InitAsync(PluginInitContext context) => Task.Run(() => Init(context));
|
|
|
|
|
|
|
2025-07-20 11:11:09 +00:00
|
|
|
|
Task<List<Result>> IAsyncPlugin.QueryAsync(Query query, CancellationToken token) => Task.Run(() => Query(query), token);
|
2014-05-25 10:11:27 +00:00
|
|
|
|
}
|
2021-01-17 08:10:26 +00:00
|
|
|
|
}
|