mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Add drop event.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Wox
|
||||
{
|
||||
public event Action<Result> LeftMouseClickEvent;
|
||||
public event Action<Result> RightMouseClickEvent;
|
||||
public event Action<Result,IDataObject> ItemDropEvent;
|
||||
public event Action<Result, IDataObject, DragEventArgs> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user