Refactoring ContextMenu

1. Remove ItemDropEvent
2. Remove ShowContextMenus from API
3. Fix context menu item can't be opened ( #535 ), bug introduced from PR #494 (commit 45dbb50)
4. Move open result command and load context menu command back to
MainViewModel
5. unify load context menu logic
6. other performance enhancement and potential bug fixed
This commit is contained in:
bao-qian
2016-03-26 01:20:42 +00:00
parent fbc6f78cb5
commit 5ac0837be3
11 changed files with 192 additions and 314 deletions

View File

@@ -30,9 +30,10 @@ namespace Wox
GlobalHotkey.Instance.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
MainVM.ListeningKeyPressed += (o, e) => {
MainVM.ListeningKeyPressed += (o, e) =>
{
if(e.KeyEventArgs.Key == Key.Back)
if (e.KeyEventArgs.Key == Key.Back)
{
BackKeyDownEvent?.Invoke(new WoxKeyDownEventArgs
{
@@ -158,20 +159,6 @@ namespace Wox
MainVM.UpdateResultView(results, plugin, query);
}
public void ShowContextMenu(PluginMetadata plugin, List<Result> results)
{
if (results != null && results.Count > 0)
{
results.ForEach(o =>
{
o.PluginDirectory = plugin.PluginDirectory;
o.PluginID = plugin.ID;
});
MainVM.ShowContextMenu(results, plugin.ID);
}
}
#endregion
#region Private Methods