本文整理汇总了C#中Microsoft.VisualStudio.Package.HierarchyNode.GetDragTargetHandlerNode方法的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode.GetDragTargetHandlerNode方法的具体用法?C# HierarchyNode.GetDragTargetHandlerNode怎么用?C# HierarchyNode.GetDragTargetHandlerNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.Package.HierarchyNode
的用法示例。
在下文中一共展示了HierarchyNode.GetDragTargetHandlerNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PasteFromClipboardCore
/// <summary>
/// Handle the Paste operation to a targetNode. Do not call directly
/// outside of PasteFromClipboard.
/// </summary>
private int PasteFromClipboardCore(HierarchyNode targetNode)
{
int returnValue = (int)OleConstants.OLECMDERR_E_NOTSUPPORTED;
//Get the clipboardhelper service and use it after processing dataobject
IVsUIHierWinClipboardHelper clipboardHelper = (IVsUIHierWinClipboardHelper)GetService(typeof(SVsUIHierWinClipboardHelper));
if (clipboardHelper == null)
{
return VSConstants.E_FAIL;
}
try
{
//Get dataobject from clipboard
IOleDataObject dataObject = null;
ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleGetClipboard(out dataObject));
if (dataObject == null)
{
return VSConstants.E_UNEXPECTED;
}
DropEffect dropEffect = DropEffect.None;
DropDataType dropDataType = DropDataType.None;
try
{
this.SourceDraggedOrCutOrCopied = this.dataWasCut;
dropDataType = this.ProcessSelectionDataObject(dataObject, targetNode.GetDragTargetHandlerNode(), 0);
dropEffect = this.QueryDropEffect(dropDataType, 0);
}
catch (ExternalException e)
{
Trace.WriteLine("Exception : " + e.Message);
// If it is a drop from windows and we get any kind of error ignore it. This
// prevents bogus messages from the shell from being displayed
if (dropDataType != DropDataType.Shell)
{
throw e;
}
}
finally
{
// Inform VS (UiHierarchyWindow) of the paste
returnValue = clipboardHelper.Paste(dataObject, (uint)dropEffect);
}
}
catch (COMException e)
{
Trace.WriteLine("Exception : " + e.Message);
returnValue = e.ErrorCode;
}
return returnValue;
}