Пример #1
0
        public override bool Execute()
        {
            if (DragObjects.IsNullOrEmpty() || Target == null || DragDropMethod == DragTopicsMethod.None)
            {
                return(false);
            }

            Parents = new Dictionary <ChartObject, object>();
            Indices = new Dictionary <ChartObject, int>();

            switch (DragDropMethod)
            {
            case DragTopicsMethod.Copy:
                var data = new MapClipboardData(DragObjects);
                NewObjects     = PasteCommand.PasteObjectsTo(data, Document, Target);
                AfterSelection = NewObjects;
                return(true);

            case DragTopicsMethod.Move:
                if (DeleteCommand.DeleteObjects(DragObjects, Parents, Indices))
                {
                    foreach (var co in DragObjects)
                    {
                        co.Parent = Target;
                    }
                    AfterSelection = DragObjects;
                    return(true);
                }

                return(false);

            default:
                return(false);
            }
        }