Beispiel #1
0
 public override void OnDrop(DragEventArgs e)
 {
     try
     {
         e.Effects = DragDropEffects.None;
         this.UpdateFeedback(false, (DragEventArgs)null);
         if (this.TargetItem != null)
         {
             if (this.DragDropContext != null)
             {
                 IDropAction instance = DropActionFactory.CreateInstance(this.DragDropContext);
                 if (instance != null)
                 {
                     e.Effects = instance.HandleDrop(this.DragDropContext.Descriptor.ResultEffects);
                 }
             }
         }
     }
     finally
     {
         this.hittestResult = (StructureViewDragDropHandler.HittestResult)null;
         e.Handled          = true;
     }
     base.OnDrop(e);
 }
Beispiel #2
0
        private bool TryDrop(DragEventArgs e, TimelineDropEffects requestedEffects)
        {
            this.DragDropContext = new DragDropContext(e.Data, this.TargetItem, requestedEffects);
            IDropAction instance = DropActionFactory.CreateInstance(this.DragDropContext);

            if (instance != null)
            {
                return(instance.CanDrop(this.DragDropContext.Descriptor));
            }
            return(false);
        }
        private DragDropEffects ComputeDropEffects(DragEventArgs e)
        {
            TimelineDropEffects allowedEffects1 = TimelineDropEffects.None;

            if ((this.HitTestResult & DropHitTestResults.UpperHalf) != DropHitTestResults.None)
            {
                allowedEffects1 = !this.TimelineItem.TimelineItemManager.SortByZOrder ? TimelineDropEffects.After : TimelineDropEffects.Before;
            }
            else if ((this.HitTestResult & DropHitTestResults.LowerHalf) != DropHitTestResults.None)
            {
                allowedEffects1 = !this.TimelineItem.TimelineItemManager.SortByZOrder ? TimelineDropEffects.Before : TimelineDropEffects.After;
            }
            if ((e.AllowedEffects & DragDropEffects.Copy) != DragDropEffects.None && this.IsCopyKeyState(e.KeyStates))
            {
                allowedEffects1 |= TimelineDropEffects.Copy;
            }
            if ((e.AllowedEffects & DragDropEffects.Move) != DragDropEffects.None)
            {
                allowedEffects1 |= TimelineDropEffects.Move;
            }
            if ((this.HitTestResult & DropHitTestResults.CenterHalf) != DropHitTestResults.None)
            {
                TimelineDropEffects allowedEffects2 = allowedEffects1 & ~(TimelineDropEffects.Before | TimelineDropEffects.After);
                this.DragDropContext = new DragDropContext(e.Data, this.TimelineItem, allowedEffects2);
                IDropAction instance = DropActionFactory.CreateInstance(this.DragDropContext);
                if (instance != null && instance.CanDrop(this.DragDropContext.Descriptor))
                {
                    return(this.DragDropContext.Descriptor.ResultEffects);
                }
            }
            this.DragDropContext = new DragDropContext(e.Data, this.TimelineItem, allowedEffects1);
            IDropAction instance1 = DropActionFactory.CreateInstance(this.DragDropContext);

            if (instance1 != null && instance1.CanDrop(this.DragDropContext.Descriptor))
            {
                return(this.DragDropContext.Descriptor.ResultEffects);
            }
            this.DragDropContext.Descriptor.DisableDrop();
            return(this.DragDropContext.Descriptor.ResultEffects);
        }