diff --git a/Flow.Launcher.Plugin/Features.cs b/Flow.Launcher.Plugin/Features.cs index 4b7e03718..5b9c6a7b9 100644 --- a/Flow.Launcher.Plugin/Features.cs +++ b/Flow.Launcher.Plugin/Features.cs @@ -2,86 +2,13 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Threading; -using System.Threading.Tasks; namespace Flow.Launcher.Plugin { + /// + /// Base Interface for Flow's special plugin feature interface + /// public interface IFeatures { } - - public interface IContextMenu : IFeatures - { - List LoadContextMenus(Result selectedResult); - } - - /// - /// Represent plugins that support internationalization - /// - public interface IPluginI18n : IFeatures - { - string GetTranslatedPluginTitle(); - - string GetTranslatedPluginDescription(); - } - - public interface IResultUpdated : IFeatures - { - event ResultUpdatedEventHandler ResultsUpdated; - } - - public delegate void ResultUpdatedEventHandler(IResultUpdated sender, ResultUpdatedEventArgs e); - - public class ResultUpdatedEventArgs : EventArgs - { - public List Results; - public Query Query; - public CancellationToken Token { get; init; } = default; - } - - /// - /// This interface is to indicate and allow plugins to asyncronously reload their - /// in memory data cache or other mediums when user makes a new change - /// that is not immediately captured. For example, for BrowserBookmark and Program - /// plugin does not automatically detect when a user added a new bookmark or program, - /// so this interface's function is exposed to allow user manually do the reloading after - /// those new additions. - /// - /// The command that allows user to manual reload is exposed via Plugin.Sys, and - /// it will call the plugins that have implemented this interface. - /// - public interface IAsyncReloadable : IFeatures - { - Task ReloadDataAsync(); - } - - /// - /// This interface is to indicate and allow plugins to synchronously reload their - /// in memory data cache or other mediums when user makes a new change - /// that is not immediately captured. For example, for BrowserBookmark and Program - /// plugin does not automatically detect when a user added a new bookmark or program, - /// so this interface's function is exposed to allow user manually do the reloading after - /// those new additions. - /// - /// The command that allows user to manual reload is exposed via Plugin.Sys, and - /// it will call the plugins that have implemented this interface. - /// - /// - /// If requiring reloading data asynchronously, please use the IAsyncReloadable interface - /// - /// - public interface IReloadable : IFeatures - { - void ReloadData(); - } - - /// - /// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved, - /// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded, - /// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow - /// - public interface ISavable : IFeatures - { - void Save(); - } } \ No newline at end of file diff --git a/Flow.Launcher.Plugin/IAsyncReloadable.cs b/Flow.Launcher.Plugin/IAsyncReloadable.cs new file mode 100644 index 000000000..bd4500a7e --- /dev/null +++ b/Flow.Launcher.Plugin/IAsyncReloadable.cs @@ -0,0 +1,20 @@ +using System.Threading.Tasks; + +namespace Flow.Launcher.Plugin +{ + /// + /// This interface is to indicate and allow plugins to asyncronously reload their + /// in memory data cache or other mediums when user makes a new change + /// that is not immediately captured. For example, for BrowserBookmark and Program + /// plugin does not automatically detect when a user added a new bookmark or program, + /// so this interface's function is exposed to allow user manually do the reloading after + /// those new additions. + /// + /// The command that allows user to manual reload is exposed via Plugin.Sys, and + /// it will call the plugins that have implemented this interface. + /// + public interface IAsyncReloadable : IFeatures + { + Task ReloadDataAsync(); + } +} \ No newline at end of file diff --git a/Flow.Launcher.Plugin/IContextMenu.cs b/Flow.Launcher.Plugin/IContextMenu.cs new file mode 100644 index 000000000..5befbf5c9 --- /dev/null +++ b/Flow.Launcher.Plugin/IContextMenu.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Flow.Launcher.Plugin +{ + public interface IContextMenu : IFeatures + { + List LoadContextMenus(Result selectedResult); + } +} \ No newline at end of file diff --git a/Flow.Launcher.Plugin/IPluginI18n.cs b/Flow.Launcher.Plugin/IPluginI18n.cs new file mode 100644 index 000000000..e332d450e --- /dev/null +++ b/Flow.Launcher.Plugin/IPluginI18n.cs @@ -0,0 +1,12 @@ +namespace Flow.Launcher.Plugin +{ + /// + /// Represent plugins that support internationalization + /// + public interface IPluginI18n : IFeatures + { + string GetTranslatedPluginTitle(); + + string GetTranslatedPluginDescription(); + } +} \ No newline at end of file diff --git a/Flow.Launcher.Plugin/IReloadable.cs b/Flow.Launcher.Plugin/IReloadable.cs new file mode 100644 index 000000000..bd1ad406e --- /dev/null +++ b/Flow.Launcher.Plugin/IReloadable.cs @@ -0,0 +1,22 @@ +namespace Flow.Launcher.Plugin +{ + /// + /// This interface is to indicate and allow plugins to synchronously reload their + /// in memory data cache or other mediums when user makes a new change + /// that is not immediately captured. For example, for BrowserBookmark and Program + /// plugin does not automatically detect when a user added a new bookmark or program, + /// so this interface's function is exposed to allow user manually do the reloading after + /// those new additions. + /// + /// The command that allows user to manual reload is exposed via Plugin.Sys, and + /// it will call the plugins that have implemented this interface. + /// + /// + /// If requiring reloading data asynchronously, please use the IAsyncReloadable interface + /// + /// + public interface IReloadable : IFeatures + { + void ReloadData(); + } +} \ No newline at end of file diff --git a/Flow.Launcher.Plugin/IResultUpdated.cs b/Flow.Launcher.Plugin/IResultUpdated.cs new file mode 100644 index 000000000..fd21460ac --- /dev/null +++ b/Flow.Launcher.Plugin/IResultUpdated.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Threading; + +namespace Flow.Launcher.Plugin +{ + public interface IResultUpdated : IFeatures + { + event ResultUpdatedEventHandler ResultsUpdated; + } + + public delegate void ResultUpdatedEventHandler(IResultUpdated sender, ResultUpdatedEventArgs e); + + public class ResultUpdatedEventArgs : EventArgs + { + public List Results; + public Query Query; + public CancellationToken Token { get; init; } + } +} \ No newline at end of file diff --git a/Flow.Launcher.Plugin/ISavable.cs b/Flow.Launcher.Plugin/ISavable.cs new file mode 100644 index 000000000..2d13eaa6e --- /dev/null +++ b/Flow.Launcher.Plugin/ISavable.cs @@ -0,0 +1,12 @@ +namespace Flow.Launcher.Plugin +{ + /// + /// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved, + /// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded, + /// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow + /// + public interface ISavable : IFeatures + { + void Save(); + } +} \ No newline at end of file