You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here you will find documentation on usage tips, design information, plugin development and more.
3
+
Here you will find documentation on usage tips, design information, plugin development, and more.
4
4
5
-
If you have just started using Flow, please head over to the [Usage Tips](/usage-tips.md) section to find out how you can get the most out of Flow. Otherwise if you are completely new to Flow and want to find out its features and give it a spin, please visit [here](https://github.com/Flow-Launcher/Flow.Launcher/#-features).
5
+
If you have just started using Flow, please head over to the [Usage Tips](/usage-tips.md) section to find out how you can get the most out of Flow. Otherwise, if you are completely new to Flow and want to find out its features and give it a spin, please visit [here](https://github.com/Flow-Launcher/Flow.Launcher/#-features).
Flow is written in C#, so plugins written in .Net platform can directly communicate with Flow without extra protocols.
1
+
Flow is written in C#, so plugins written in .NET platform can directly communicate with Flow without extra protocols.
2
2
3
3
## Initialization
4
4
5
5
For C# Plugins, We recommend you use the [dotnet template](https://github.com/Flow-Launcher/dotnet-template) to generate a plugin template.
6
6
7
-
In order to be recognized as a Flow DotNet plugin, the directory needs to have at least two files
8
-
1.[`plugin.json`](plugin.json.md)
9
-
2. A Dotnet Assembly that implements **[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)** or **[IAsyncPlugin](API-Reference/Flow.Launcher.Plugin/iasyncplugin.md)** (remember to reference [Flow.Launcher.Plugin](https://www.nuget.org/packages/Flow.Launcher.Plugin/) by Nuget). The plugin template will add the reference and create a `Main.cs` that implements `IPlugin`.
7
+
To be recognized as a Flow DotNet plugin, the directory needs to have at least two files
8
+
1.[`plugin.json`](/plugin.json.md)
9
+
2. A Dotnet Assembly that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** (remember to reference [Flow.Launcher.Plugin](https://www.nuget.org/packages/Flow.Launcher.Plugin/) by Nuget). The plugin template will add the reference and create a `Main.cs` that implements `IPlugin`.
10
10
11
-
Find our API Reference [here](API-Reference/)
11
+
Find our API Reference [here](/API-Reference/Flow.Launcher.Plugin.md)
12
12
13
13
14
14
A sample CSharp Plugin [here](https://github.com/Flow-Launcher/plugin-samples)
15
15
16
16
## IPlugin/IAsyncPlugin
17
17
18
-
The `Main`class that implements **[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)** or **[IAsyncPlugin](API-Reference/Flow.Launcher.Plugin/iasyncplugin.md)** will handle the query search with Flow.
18
+
The `Main`class that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** will handle the query search with Flow.
19
19
20
-
**[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)** interface contains two required methods:
20
+
**[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** interface contains two required methods:
21
21
1.`void Init(PluginInitContext context)`
22
-
-[PluginInitContext](https://github.com/Flow-Launcher/Flow.Launcher/blob/master/API-Reference/Flow.Launcher.Plugin/PluginInitContext.cs) exposes some API from Flow and an metadata object for your plugin.
22
+
-[PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) exposes some API from Flow and a metadata object for your plugin.
23
23
- It will be invoked before the invocation of `Query`, so you can do some preparation here.
24
24
- We recommend you do expensive operations in this method instead of Object Constructor because this method will be executed in parallel with other plugins.
25
25
2.`List<Result> Query(Query query)`
26
-
-`Query` will be invoked when user activate this plugin with specific ActionKeyword.
27
-
- A `List` of [Result](/API-Reference/Flow.Launcher.Plugin/result.md) object should be returned.
26
+
-`Query` will be invoked when user activates this plugin with specific ActionKeyword.
27
+
- A `List` of [Result](/API-Reference/Flow.Launcher.Plugin/Result.md) object should be returned.
28
28
29
-
**[IAsyncPlugin](API-Reference/Flow.Launcher.Plugin/iasyncplugin.md)** is the async version of **[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)**
29
+
**[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** is the async version of **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)**
30
30
- Instead of implementing `Init` and `Query`, you will need to implement `InitAsync`and `QueryAsync`, which use `Task`,`Task<List<Result>` as return value to allow using `async/await` strategy
31
31
-`QueryAsync` provides a `CancellationToken token` to allow you to check whether user has typed a new query.
32
32
33
33
34
34
## Additional interfaces
35
35
36
-
Besides the basic implementation of **IPlugin/IAsyncPlugin**, plugins can also implement a series of interfaces that belongs to **IFeatures** to control more communication with Flow.
36
+
Besides the basic implementation of **IPlugin/IAsyncPlugin**, plugins can also implement a series of interfaces that belong to **IFeatures** to control more communication with Flow.
37
37
38
38
**Remarks**: You should implement these interfaces in the same class that implements **IPlugin/IAsyncPlugin**.
`ReloadData/ReloadDataAsync` will be invoked when users click the `Reload Plugin Data` command from _sys_ plugin. Generally, it is used to reload some cache (such as the programs information cached in _Program_ plugin).
**IPluginI18n** means the plugin has been internationalized. Therefore, Flow will load the additional language resources from `/Languages` when loading the plugin.
52
52
By implementing this interface with additional language files, Flow will be able to load plugin-specific localized language resources. You will be able to get the translated text with `IPublicAPI.GetTranslation(string key)`.
@@ -60,13 +60,13 @@ The Language Resource file will need to be a list of **key/value** pair. Follow
60
60
61
61
Plugins are required to implement **IPublicI18n** to let Flow load Language resources.
Implementing **IResultUpdated** provides a way to return part of the query results early. This is generally useful for plugins with longrunning queries.
66
+
Implementing **IResultUpdated** provides a way to return part of the query results early. This is generally useful for plugins with long-running queries.
67
67
68
68
To early return a result to Flow, you will need to invoke `ResultUpdated` event with an `ResultUpdatedEventArgs`, which includes the current `Query` object and the List of `Result` objects similar to the return value in `Query(Async)`.
69
69
70
70
### [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)*Flow 1.8.0 or higher*
71
71
72
-
Implementing **IDisposable** to dispose unmanaged resource in the plugin. `Dispose()` will be called when Flow exit.
72
+
Implementing **IDisposable** to dispose unmanaged resource in the plugin. `Dispose()` will be called when Flow exit.
0 commit comments