diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs
index 9188d9afd3..40ce63ef53 100644
--- a/Wox.Plugin/IPublicAPI.cs
+++ b/Wox.Plugin/IPublicAPI.cs
@@ -4,10 +4,13 @@ using System.Windows.Documents;
namespace Wox.Plugin
{
+ ///
+ /// Public APIs that plugin can use
+ ///
public interface IPublicAPI
{
///
- /// Push result to query window
+ /// Push result to query box
///
///
///
@@ -15,43 +18,106 @@ namespace Wox.Plugin
///
void PushResults(Query query,PluginMetadata plugin, List results,bool clearBeforeInsert = false);
+ ///
+ /// Execute command
+ /// a replacement to RUN(win+r) function
+ ///
+ /// command that want to execute
+ /// run as administrator
+ ///
bool ShellRun(string cmd, bool runAsAdministrator = false);
+ ///
+ /// Change Wox query
+ ///
+ /// query text
+ ///
+ /// 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
+ ///
void ChangeQuery(string query, bool requery = false);
+ ///
+ /// Close Wox
+ ///
void CloseApp();
+ ///
+ /// Hide Wox
+ ///
void HideApp();
+ ///
+ /// Show Wox
+ ///
void ShowApp();
+ ///
+ /// Show message box
+ ///
+ /// Message title
+ /// Message subtitle
+ /// Message icon path (relative path to your plugin folder)
void ShowMsg(string title, string subTitle, string iconPath);
+ ///
+ /// Open setting dialog
+ ///
void OpenSettingDialog();
-
+
+ ///
+ /// Show loading animation
+ ///
void StartLoadingBar();
+ ///
+ /// Stop loading animation
+ ///
void StopLoadingBar();
+ ///
+ /// Install Wox plugin
+ ///
+ /// Plugin path (ends with .wox)
void InstallPlugin(string path);
+ ///
+ /// Reload all plugins
+ ///
void ReloadPlugins();
+ ///
+ /// Get translation of current language
+ /// You need to implement IPluginI18n if you want to support multiple languages for your plugin
+ ///
+ ///
+ ///
string GetTranslation(string key);
+ ///
+ /// Get all loaded plugins
+ ///
+ ///
List GetAllPlugins();
+ ///
+ /// Fired after Back key down in the Wox query box
+ ///
event WoxKeyDownEventHandler BackKeyDownEvent;
+ ///
+ /// Fired after global keyboard events
+ /// if you want to hook something like Ctrl+R, you should use this event
+ ///
event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent;
///
- /// fired after wox execute a query
+ /// Fired after wox execute a query
///
event AfterWoxQueryEventHandler AfterWoxQueryEvent;
///
- /// fired before wox start to execute a query
+ /// Fired before wox start to execute a query
///
event AfterWoxQueryEventHandler BeforeWoxQueryEvent;
}
diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs
index e80c981372..fbbe8ff36d 100644
--- a/Wox/MainWindow.xaml.cs
+++ b/Wox/MainWindow.xaml.cs
@@ -364,7 +364,6 @@ namespace Wox
var q = new Query(lastQuery);
FireBeforeWoxQueryEvent(q);
Query(q);
- BackToResultMode();
Dispatcher.DelayInvoke("ShowProgressbar", originQuery =>
{
if (!queryHasReturn && originQuery == lastQuery)
@@ -373,7 +372,7 @@ namespace Wox
}
}, TimeSpan.FromMilliseconds(150), lastQuery);
FireAfterWoxQueryEvent(q);
- }, TimeSpan.FromMilliseconds(ShouldNotDelayQuery ? 0 : 200));
+ }, TimeSpan.FromMilliseconds(200));
}
private void FireAfterWoxQueryEvent(Query q)
@@ -410,15 +409,9 @@ namespace Wox
private void Query(Query q)
{
- try
- {
- PluginManager.Query(q);
- }
- catch (Exception e)
- {
- StopProgress();
- ErrorReporting.Report(e);
- }
+ PluginManager.Query(q);
+ StopProgress();
+ BackToResultMode();
}
private void BackToResultMode()
@@ -427,22 +420,6 @@ namespace Wox
pnlContextMenu.Visibility = Visibility.Collapsed;
}
- private bool ShouldNotDelayQuery
- {
- get
- {
- return IsCMDMode || IsWebSearchMode;
- }
- }
-
- private bool IsCMDMode
- {
- get
- {
- return tbQuery.Text.StartsWith(">");
- }
- }
-
private bool IsWebSearchMode
{
get
@@ -500,17 +477,6 @@ namespace Wox
}
}
- private void updateCmdMode()
- {
- var currentSelectedItem = pnlResult.GetActiveResult();
- if (currentSelectedItem != null)
- {
- ignoreTextChange = true;
- tbQuery.Text = ">" + currentSelectedItem.Title;
- tbQuery.CaretIndex = tbQuery.Text.Length;
- }
- }
-
private void TbQuery_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
//when alt is pressed, the real key should be e.SystemKey
@@ -553,14 +519,12 @@ namespace Wox
case Key.PageDown:
pnlResult.SelectNextPage();
- if (IsCMDMode) updateCmdMode();
toolTip.IsOpen = false;
e.Handled = true;
break;
case Key.PageUp:
pnlResult.SelectPrevPage();
- if (IsCMDMode) updateCmdMode();
toolTip.IsOpen = false;
e.Handled = true;
break;
@@ -621,7 +585,6 @@ namespace Wox
else
{
pnlResult.SelectPrev();
- if (IsCMDMode) updateCmdMode();
}
toolTip.IsOpen = false;
}
@@ -635,7 +598,6 @@ namespace Wox
else
{
pnlResult.SelectNext();
- if (IsCMDMode) updateCmdMode();
}
toolTip.IsOpen = false;
}