src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/UI/VirtualTreeControl.cs
/// <summary>
///     Helper function to do both the CanPaste and Paste operations
/// </summary>
/// <param name="canPasteOnly">true if this is only a test (called by CanPaste)</param>
/// <returns>true if a paste is possible or succeeded</returns>
Helper function to do both the CanPaste and Paste operations
Helper function to do both the CanPaste and Paste operations
private bool DoPaste(bool canPasteOnly)
        {
            int index;
            int selectionColumn;
            if (myTree != null
                && (-1 != (index = CurrentIndex))
                && (-1 != (selectionColumn = mySelectionColumn)))
            {
                IDataObject dataObject = null;
                try
                {
                    dataObject = Clipboard.GetDataObject();
                }
                catch (COMException)
                {
                }
                if (dataObject == null)
                {
                    return false;
                }
                int nativeSelectionColumn;
                ResolveSelectionColumn(index, out selectionColumn, out nativeSelectionColumn);
                var info = myTree.GetItemInfo(
                    index, (myColumnPermutation != null) ? myColumnPermutation.GetNativeColumn(selectionColumn) : selectionColumn, false);
                var args = new DragEventArgs(
                    dataObject, 0, -1, -1, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move, DragDropEffects.None);
                info.Branch.OnDragEvent(this, info.Row, info.Column, DragEventType.Enter, args);
                if ((args.Effect & args.AllowedEffect) != DragDropEffects.None)
                {
                    DragEventType closingEvent;
                    if (canPasteOnly)
                    {
                        closingEvent = DragEventType.Leave;
                        args = null;
                    }
                    else
                    {
                        closingEvent = DragEventType.Drop;
                    }
                    info.Branch.OnDragEvent(this, info.Row, info.Column, closingEvent, args);
                    return true;
                }
            }
            return false;
        }
private bool DoPaste ( bool canPasteOnly ) { int index ; int selectionColumn ; if ( myTree != null && ( - 1 != ( index = CurrentIndex ) ) && ( - 1 != ( selectionColumn = mySelectionColumn ) ) ) { IDataObject dataObject = null ; try { dataObject = Clipboard . GetDataObject ( ) ; } catch ( COMException ) { } if ( dataObject == null ) { return false ; } int nativeSelectionColumn ; ResolveSelectionColumn ( index , out selectionColumn , out nativeSelectionColumn ) ; var info = myTree . GetItemInfo ( index , ( myColumnPermutation != null ) ? myColumnPermutation . GetNativeColumn ( selectionColumn ) : selectionColumn , false ) ; var args = new DragEventArgs ( dataObject , 0 , - 1 , - 1 , DragDropEffects . Copy | DragDropEffects . Link | DragDropEffects . Move , DragDropEffects . None ) ; info . Branch . OnDragEvent ( this , info . Row , info . Column , DragEventType . Enter , args ) ; if ( ( args . Effect & args . AllowedEffect ) != DragDropEffects . None ) { DragEventType closingEvent ; if ( canPasteOnly ) { closingEvent = DragEventType . Leave ; args = null ; } else { closingEvent = DragEventType . Drop ; } info . Branch . OnDragEvent ( this , info . Row , info . Column , closingEvent , args ) ; return true ; } } return false ; }
Helper function to do both the CanPaste and Paste operations
Helper function to do both the CanPaste and Paste operations
// Happens occasionally, treat like no data // Call the final event to make sure the branch can clean up
true if a paste is possible or succeeded
true if a paste is possible or succeeded
canPasteOnly
bool
true if this is only a test (called by CanPaste)
true if this is only a test ( called by CanPaste )