diff --git a/Plugins/Wox.Plugin.Folder/FolderPlugin.cs b/Plugins/Wox.Plugin.Folder/FolderPlugin.cs index ed9127509c..da5525ffc9 100644 --- a/Plugins/Wox.Plugin.Folder/FolderPlugin.cs +++ b/Plugins/Wox.Plugin.Folder/FolderPlugin.cs @@ -23,6 +23,7 @@ namespace Wox.Plugin.Folder { this.context = context; this.context.API.BackKeyDownEvent += ApiBackKeyDownEvent; + this.context.API.ResultItemDropEvent += API_ResultItemDropEvent; InitialDriverList(); if (FolderStorage.Instance.FolderLinks == null) { @@ -31,6 +32,11 @@ namespace Wox.Plugin.Folder } } + void API_ResultItemDropEvent(Result result, IDataObject dropObject,DragEventArgs e) + { + e.Handled = true; + } + private void ApiBackKeyDownEvent(WoxKeyDownEventArgs e) { string query = e.Query; diff --git a/Plugins/Wox.Plugin.Program/Programs.cs b/Plugins/Wox.Plugin.Program/Programs.cs index 92da2c1959..ded1fea3e3 100644 --- a/Plugins/Wox.Plugin.Program/Programs.cs +++ b/Plugins/Wox.Plugin.Program/Programs.cs @@ -115,9 +115,9 @@ namespace Wox.Plugin.Program } } - void API_ResultItemDropEvent(Result result, IDataObject dropObject) + void API_ResultItemDropEvent(Result result, IDataObject dropObject, DragEventArgs args) { - + args.Handled = true; } public static void IndexPrograms() diff --git a/Wox.Core/Plugin/JsonRPCPlugin.cs b/Wox.Core/Plugin/JsonRPCPlugin.cs index fd0514af36..877ff10e9b 100644 --- a/Wox.Core/Plugin/JsonRPCPlugin.cs +++ b/Wox.Core/Plugin/JsonRPCPlugin.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using Newtonsoft.Json; using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Core.Exception; namespace Wox.Core.Plugin { @@ -83,7 +84,7 @@ namespace Wox.Core.Plugin private void ExecuteWoxAPI(string method, object[] parameters) { MethodInfo methodInfo = PluginManager.API.GetType().GetMethod(method); - if (methodInfo != null) + if (methodInfo != null) { try { @@ -141,8 +142,7 @@ namespace Wox.Core.Plugin string error = errorReader.ReadToEnd(); if (!string.IsNullOrEmpty(error)) { - //todo: - // ErrorReporting.TryShowErrorMessageBox(error, new WoxJsonRPCException(error)); + throw new WoxJsonRPCException(error); } } } @@ -151,9 +151,9 @@ namespace Wox.Core.Plugin } } } - catch + catch(System.Exception e) { - return null; + throw new WoxJsonRPCException(e.Message); } return null; } diff --git a/Wox.CrashReporter/ReportWindow.xaml.cs b/Wox.CrashReporter/ReportWindow.xaml.cs index 7a6ec983c5..05612cd9ca 100644 --- a/Wox.CrashReporter/ReportWindow.xaml.cs +++ b/Wox.CrashReporter/ReportWindow.xaml.cs @@ -19,6 +19,7 @@ using Wox.Core.UI; using Wox.Core.Updater; using Wox.Core.UserSettings; using Wox.Infrastructure.Http; +using Wox.Infrastructure.Logger; namespace Wox.CrashReporter { @@ -53,15 +54,12 @@ namespace Wox.CrashReporter private void SendReport() { + Hide(); string error = string.Format("{{\"data\":{0}}}", ExceptionFormatter.FormatExcpetion(exception)); string response = HttpRequest.Post(APIServer.ErrorReportURL, error, HttpProxy.Instance); - if (response.ToLower() == "ok") + if (response.ToLower() != "ok") { - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("reportWindow_report_succeed")); - } - else - { - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("reportWindow_report_failed")); + Log.Warn("sending crash report failed: " + response); } Dispatcher.Invoke(new Action(Close)); } diff --git a/Wox.Plugin/EventHandler.cs b/Wox.Plugin/EventHandler.cs index 3aa31c938a..1bbe950a4f 100644 --- a/Wox.Plugin/EventHandler.cs +++ b/Wox.Plugin/EventHandler.cs @@ -10,7 +10,7 @@ namespace Wox.Plugin public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e); public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e); - public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject); + public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject, DragEventArgs e); /// /// Global keyboard events diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 7c200fbe26..fb7c1789fd 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -195,15 +195,17 @@ namespace Wox }); } - void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject) + void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject, DragEventArgs args) { - if (ResultItemDropEvent != null) + PluginPair pluginPair = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ID == result.PluginID); + if (ResultItemDropEvent != null && pluginPair != null) { - PluginPair pluginPair = PluginManager.AllPlugins.FirstOrDefault(o => o.Plugin == ResultItemDropEvent.Target); - if (pluginPair != null) + foreach (var delegateHandler in ResultItemDropEvent.GetInvocationList()) { - //todo: - ResultItemDropEvent(result, dropDataObject); + if (delegateHandler.Target == pluginPair.Plugin) + { + delegateHandler.DynamicInvoke(result, dropDataObject, args); + } } } } diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 18ddd76707..2a1d217175 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -16,7 +16,7 @@ namespace Wox { public event Action LeftMouseClickEvent; public event Action RightMouseClickEvent; - public event Action ItemDropEvent; + public event Action ItemDropEvent; protected virtual void OnRightMouseClick(Result result) { @@ -215,14 +215,14 @@ namespace Wox var item = ItemsControl.ContainerFromElement(lbResults, e.OriginalSource as DependencyObject) as ListBoxItem; if (item != null) { - OnItemDropEvent(item.DataContext as Result,e.Data); + OnItemDropEvent(item.DataContext as Result, e.Data, e); } } - protected virtual void OnItemDropEvent(Result obj, IDataObject data) + protected virtual void OnItemDropEvent(Result obj, IDataObject data, DragEventArgs e) { var handler = ItemDropEvent; - if (handler != null) handler(obj,data); + if (handler != null) handler(obj, data, e); } } } \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 76871e1456..429a0011e1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,6 @@ build: after_test: - ps: .\deploy\nuget\pack.ps1 - cmd: .\deploy\UpdateGenerator\build.bat - #- cmd: .\deploy\Cleanup.bat deploy: provider: NuGet