diff --git a/Plugins/Wox.Plugin.Program/Images/folder.png b/Plugins/Wox.Plugin.Program/Images/folder.png new file mode 100644 index 0000000000..330cb2e4bf Binary files /dev/null and b/Plugins/Wox.Plugin.Program/Images/folder.png differ diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs index cb62dc8316..f4997615e8 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs @@ -16,7 +16,8 @@ namespace Wox.Plugin.Program.ProgramSources this.baseDirectory = baseDirectory; } - public FileSystemProgramSource(ProgramSource source):this(source.Location) + public FileSystemProgramSource(ProgramSource source) + : this(source.Location) { this.BonusPoints = source.BonusPoints; } @@ -50,17 +51,9 @@ namespace Wox.Plugin.Program.ProgramSources GetAppFromDirectory(subDirectory, list); } } - catch (UnauthorizedAccessException e) + catch (Exception e) { - Log.Warn(string.Format("Can't access to directory {0}", path)); - } - catch (DirectoryNotFoundException e) - { - Log.Warn(string.Format("Directory {0} doesn't exist", path)); - } - catch (PathTooLongException e) - { - Log.Warn(string.Format("File path too long: {0}", e.Message)); + Log.Warn(string.Format("GetAppFromDirectory failed: {0} - {1}", path, e.Message)); } } diff --git a/Plugins/Wox.Plugin.Program/Programs.cs b/Plugins/Wox.Plugin.Program/Programs.cs index 7028848b83..92da2c1959 100644 --- a/Plugins/Wox.Plugin.Program/Programs.cs +++ b/Plugins/Wox.Plugin.Program/Programs.cs @@ -103,6 +103,7 @@ namespace Wox.Plugin.Program public void Init(PluginInitContext context) { this.context = context; + this.context.API.ResultItemDropEvent += API_ResultItemDropEvent; using (new Timeit("Preload programs")) { programs = ProgramCacheStorage.Instance.Programs; @@ -114,6 +115,11 @@ namespace Wox.Plugin.Program } } + void API_ResultItemDropEvent(Result result, IDataObject dropObject) + { + + } + public static void IndexPrograms() { lock (lockObject) diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index a517e1407e..0f357736f1 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -1,150 +1,153 @@ - - - - - Debug - AnyCPU - {FDB3555B-58EF-4AE6-B5F1-904719637AB4} - Library - Properties - Wox.Plugin.Program - Wox.Plugin.Program - v3.5 - 512 - ..\..\ - true - - - - true - full - false - ..\..\Output\Debug\Plugins\Wox.Plugin.Program\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - ..\..\Output\Release\Plugins\Wox.Plugin.Program\ - TRACE - prompt - 4 - false - - - - False - ..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - ProgramSetting.xaml - - - - - - - - - ProgramSuffixes.xaml - - - - - - - - PreserveNewest - - - - - PreserveNewest - - - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - PreserveNewest - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - - {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} - Wox.Infrastructure - - - {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} - Wox.Plugin - - - - - {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} - 1 - 0 - 0 - tlbimp - False - True - - - - - - - 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - + + + + + Debug + AnyCPU + {FDB3555B-58EF-4AE6-B5F1-904719637AB4} + Library + Properties + Wox.Plugin.Program + Wox.Plugin.Program + v3.5 + 512 + ..\..\ + true + + + + true + full + false + ..\..\Output\Debug\Plugins\Wox.Plugin.Program\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + ..\..\Output\Release\Plugins\Wox.Plugin.Program\ + TRACE + prompt + 4 + false + + + + False + ..\..\packages\Newtonsoft.Json.6.0.8\lib\net35\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + ProgramSetting.xaml + + + + + + + + + ProgramSuffixes.xaml + + + + + + + + PreserveNewest + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + MSBuild:Compile + Designer + PreserveNewest + + + + + MSBuild:Compile + Designer + PreserveNewest + + + MSBuild:Compile + Designer + PreserveNewest + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} + Wox.Infrastructure + + + {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} + Wox.Plugin + + + + + {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} + 1 + 0 + 0 + tlbimp + False + True + + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + --> \ No newline at end of file diff --git a/Wox.Core/Updater/UpdaterManager.cs b/Wox.Core/Updater/UpdaterManager.cs index 258d3c0b6f..21b43cfef7 100644 --- a/Wox.Core/Updater/UpdaterManager.cs +++ b/Wox.Core/Updater/UpdaterManager.cs @@ -22,8 +22,8 @@ namespace Wox.Core.Updater { private static UpdaterManager instance; private const string VersionCheckURL = "https://api.getwox.com/release/latest/"; - //private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml"; - private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml"; + private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml"; + //private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml"; private static SemanticVersion currentVersion; public event EventHandler PrepareUpdateReady; diff --git a/Wox.Plugin/EventHandler.cs b/Wox.Plugin/EventHandler.cs index f3c6121f92..3aa31c938a 100644 --- a/Wox.Plugin/EventHandler.cs +++ b/Wox.Plugin/EventHandler.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Windows; using System.Windows.Input; namespace Wox.Plugin @@ -9,6 +10,8 @@ namespace Wox.Plugin public delegate void WoxKeyDownEventHandler(WoxKeyDownEventArgs e); public delegate void AfterWoxQueryEventHandler(WoxQueryEventArgs e); + public delegate void ResultItemDropEventHandler(Result result, IDataObject dropObject); + /// /// Global keyboard events /// diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs index 972d281f92..1e9ec5c059 100644 --- a/Wox.Plugin/IPublicAPI.cs +++ b/Wox.Plugin/IPublicAPI.cs @@ -119,5 +119,10 @@ namespace Wox.Plugin /// Fired before wox start to execute a query /// event AfterWoxQueryEventHandler BeforeWoxQueryEvent; + + /// + /// Fired after drop to result item of current plugin + /// + event ResultItemDropEventHandler ResultItemDropEvent; } } diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 1f408c20e4..1e6cae46a6 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -34,6 +34,7 @@ using MenuItem = System.Windows.Forms.MenuItem; using MessageBox = System.Windows.MessageBox; using ToolTip = System.Windows.Controls.ToolTip; using Wox.Infrastructure.Logger; +using IDataObject = System.Windows.IDataObject; namespace Wox { @@ -135,6 +136,7 @@ namespace Wox public event WoxGlobalKeyboardEventHandler GlobalKeyboardEvent; public event AfterWoxQueryEventHandler AfterWoxQueryEvent; public event AfterWoxQueryEventHandler BeforeWoxQueryEvent; + public event ResultItemDropEventHandler ResultItemDropEvent; public void PushResults(Query query, PluginMetadata plugin, List results) { @@ -168,6 +170,7 @@ namespace Wox progressBar.ToolTip = toolTip; InitialTray(); pnlResult.LeftMouseClickEvent += SelectResult; + pnlResult.ItemDropEvent += pnlResult_ItemDropEvent; pnlContextMenu.LeftMouseClickEvent += SelectResult; pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent; @@ -192,6 +195,19 @@ namespace Wox }); } + void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject) + { + if (ResultItemDropEvent != null) + { + PluginPair pluginPair = PluginManager.AllPlugins.FirstOrDefault(o => o.Plugin == ResultItemDropEvent.Target); + if (pluginPair != null) + { + //todo: + ResultItemDropEvent(result, dropDataObject); + } + } + } + private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state) { if (GlobalKeyboardEvent != null) diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index a156d6fc18..a3ada3cd38 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100"> - + diff --git a/Wox/ResultPanel.xaml.cs b/Wox/ResultPanel.xaml.cs index 7274a8c544..18ddd76707 100644 --- a/Wox/ResultPanel.xaml.cs +++ b/Wox/ResultPanel.xaml.cs @@ -16,6 +16,7 @@ namespace Wox { public event Action LeftMouseClickEvent; public event Action RightMouseClickEvent; + public event Action ItemDropEvent; protected virtual void OnRightMouseClick(Result result) { @@ -208,5 +209,20 @@ namespace Wox } Select(index); } + + private void ListBoxItem_OnDrop(object sender, DragEventArgs e) + { + var item = ItemsControl.ContainerFromElement(lbResults, e.OriginalSource as DependencyObject) as ListBoxItem; + if (item != null) + { + OnItemDropEvent(item.DataContext as Result,e.Data); + } + } + + protected virtual void OnItemDropEvent(Result obj, IDataObject data) + { + var handler = ItemDropEvent; + if (handler != null) handler(obj,data); + } } } \ No newline at end of file