Beispiel #1
0
        public override void Drop(DragEventArgs e, int index)
        {
            Debug.Assert(Context.CanDragAndDrop);
            if (!Context.CanDragAndDrop)
            {
                return;
            }

            var nodeIndexes = e.Data.GetData(FileTVConstants.DATAFORMAT_COPIED_ROOT_NODES) as int[];

            if (nodeIndexes != null)
            {
                Debug.Assert(DropNodes != null);
                DropNodes?.Invoke(index, nodeIndexes);
                return;
            }

            var filenames = e.Data.GetData(DataFormats.FileDrop) as string[];

            if (filenames != null)
            {
                Debug.Assert(DropFiles != null);
                DropFiles?.Invoke(index, filenames);
                return;
            }

            Debug.Fail("Unknown drop data format");
        }
Beispiel #2
0
        public override void Drop(DragEventArgs e, int index)
        {
            Debug.Assert(Context.CanDragAndDrop);
            if (!Context.CanDragAndDrop)
            {
                return;
            }

            if (e.Data.GetData(DocumentTreeViewConstants.DATAFORMAT_COPIED_ROOT_NODES) is int[] nodeIndexes)
            {
                Debug2.Assert(DropNodes is not null);
                DropNodes?.Invoke(index, nodeIndexes);
                return;
            }

            if (e.Data.GetData(DataFormats.FileDrop) is string[] filenames)
            {
                Debug2.Assert(DropFiles is not null);
                DropFiles?.Invoke(index, filenames);
                return;
            }

            Debug.Fail("Unknown drop data format");
        }