using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Threading; using System.Threading.Tasks; namespace Flow.Launcher.Plugin { 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(); } }