PowerToys/Wox.Plugin/IPublicAPI.cs

131 lines
4.0 KiB
C#
Raw Normal View History

2014-07-05 23:10:34 +08:00
using System;
using System.Collections.Generic;
using System.Windows.Documents;
namespace Wox.Plugin
{
2015-01-19 19:14:02 +08:00
/// <summary>
/// Public APIs that plugin can use
/// </summary>
2014-07-05 23:10:34 +08:00
public interface IPublicAPI
{
2014-12-26 22:51:04 +08:00
/// <summary>
2015-01-19 19:14:02 +08:00
/// Push result to query box
2014-12-26 22:51:04 +08:00
/// </summary>
/// <param name="query"></param>
/// <param name="plugin"></param>
/// <param name="results"></param>
2015-02-04 23:16:41 +08:00
void PushResults(Query query, PluginMetadata plugin, List<Result> results);
/// <summary>
/// Show context menu with giving results
/// </summary>
/// <param name="results"></param>
void ShowContextMenu(PluginMetadata plugin, List<Result> results);
2014-07-05 23:10:34 +08:00
2015-01-19 19:14:02 +08:00
/// <summary>
/// Execute command
/// a replacement to RUN(win+r) function
/// </summary>
/// <param name="cmd">command that want to execute</param>
/// <param name="runAsAdministrator">run as administrator</param>
/// <returns></returns>
2014-10-24 13:09:51 +08:00
bool ShellRun(string cmd, bool runAsAdministrator = false);
2014-07-05 23:10:34 +08:00
2015-01-19 19:14:02 +08:00
/// <summary>
/// Change Wox query
/// </summary>
/// <param name="query">query text</param>
/// <param name="requery">
/// force requery By default, Wox will not fire query if your query is same with existing one.
/// Set this to true to force Wox requerying
/// </param>
2014-07-05 23:10:34 +08:00
void ChangeQuery(string query, bool requery = false);
2015-02-07 16:53:33 +08:00
/// <summary>
/// Just change the query text, this won't raise search
/// </summary>
/// <param name="query"></param>
void ChangeQueryText(string query, bool selectAll = false);
2015-02-07 16:53:33 +08:00
2015-01-19 19:14:02 +08:00
/// <summary>
/// Close Wox
/// </summary>
2014-07-05 23:10:34 +08:00
void CloseApp();
2015-01-19 19:14:02 +08:00
/// <summary>
/// Hide Wox
/// </summary>
2014-07-05 23:10:34 +08:00
void HideApp();
2015-01-19 19:14:02 +08:00
/// <summary>
/// Show Wox
/// </summary>
2014-07-05 23:10:34 +08:00
void ShowApp();
2015-01-19 19:14:02 +08:00
/// <summary>
/// Show message box
/// </summary>
/// <param name="title">Message title</param>
/// <param name="subTitle">Message subtitle</param>
/// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
2015-02-07 16:53:33 +08:00
void ShowMsg(string title, string subTitle = "", string iconPath = "");
2014-07-05 23:10:34 +08:00
2015-01-19 19:14:02 +08:00
/// <summary>
/// Open setting dialog
/// </summary>
2015-02-21 21:57:00 +08:00
void OpenSettingDialog(string tabName = "general");
2015-02-04 23:16:41 +08:00
2015-01-19 19:14:02 +08:00
/// <summary>
/// Show loading animation
/// </summary>
2014-07-05 23:10:34 +08:00
void StartLoadingBar();
2015-01-19 19:14:02 +08:00
/// <summary>
/// Stop loading animation
/// </summary>
2014-07-05 23:10:34 +08:00
void StopLoadingBar();
2015-01-19 19:14:02 +08:00
/// <summary>
/// Install Wox plugin
/// </summary>
/// <param name="path">Plugin path (ends with .wox)</param>
2014-07-05 23:10:34 +08:00
void InstallPlugin(string path);
2015-01-19 19:14:02 +08:00
/// <summary>
/// Reload all plugins
/// </summary>
2014-07-05 23:10:34 +08:00
void ReloadPlugins();
2015-01-19 19:14:02 +08:00
/// <summary>
/// Get translation of current language
/// You need to implement IPluginI18n if you want to support multiple languages for your plugin
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
2015-01-06 23:24:11 +08:00
string GetTranslation(string key);
2015-01-19 19:14:02 +08:00
/// <summary>
/// Get all loaded plugins
/// </summary>
/// <returns></returns>
2014-07-05 23:10:34 +08:00
List<PluginPair> GetAllPlugins();
2014-07-19 10:12:11 +08:00
2015-01-19 19:14:02 +08:00
/// <summary>
/// Fired after Back key down in the Wox query box
/// </summary>
2014-07-19 10:12:11 +08:00
event WoxKeyDownEventHandler BackKeyDownEvent;
2015-01-19 19:14:02 +08:00
/// <summary>
/// Fired after global keyboard events
/// if you want to hook something like Ctrl+R, you should use this event
/// </summary>
event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent;
2015-02-02 23:28:40 +08:00
/// <summary>
/// Fired after drop to result item of current plugin
/// </summary>
event ResultItemDropEventHandler ResultItemDropEvent;
2014-07-05 23:10:34 +08:00
}
}