ClearCanvas.Desktop.View.WinForms.BindingTreeView.OnDragDrop C# (CSharp) Method

OnDragDrop() protected method

Called when an object is dropped onto this control
protected OnDragDrop ( DragEventArgs e ) : void
e System.Windows.Forms.DragEventArgs
return void
        protected override void OnDragDrop(DragEventArgs e)
        {
            // is there a current drop-target node?
            if (_dropTargetNode != null)
            {
                try
                {
					object dragDropData = GetDragDropData(e);
					
					// ask the node to accept the drop
					DragDropKind result = _dropTargetNode.AcceptDrop(dragDropData, GetDragDropKind(e.Effect), _dropPosition);

                    // be sure to set the resulting effect in the event args, so that it gets communicated
                    // back to the initiator of the drag drop operation
                    e.Effect = GetDragDropEffect(result);

					// Fire the item dropped event
					if (e.Effect != DragDropEffects.None)
					{
						ItemDroppedEventArgs args = new ItemDroppedEventArgs(dragDropData, result);
						EventsHelper.Fire(_itemDropped, this, args);
					}
				}
                catch (Exception ex)
                {
                    Platform.Log(LogLevel.Error, ex);
                }

                // remove highlighting from drop target node
                HighlightNode(_dropTargetNode, false);
            	SetInsertMark(_dropTargetNode, DragDropPosition.Default);
            }

            // clear the drop target node
            _dropTargetNode = null;
            _dropEffect = DragDropEffects.None;
        	_dropPosition = DragDropPosition.Default;

            base.OnDragDrop(e);
        }