Exemple #1
0
 public override void OnDragOver(DragEventArgs e)
 {
     base.OnDragOver(e);
     try
     {
         e.Effects = DragDropEffects.None;
         StructureViewDragDropHandler.HittestResult hittestResult = this.Hittest(e.GetPosition((IInputElement)this.StructureView));
         ModifierKeys modifiers = Keyboard.Modifiers;
         if (this.lastModifierKeys != modifiers || this.lastAllowedEffects != e.AllowedEffects || !object.Equals((object)this.hittestResult, (object)hittestResult))
         {
             this.lastModifierKeys   = modifiers;
             this.lastAllowedEffects = e.AllowedEffects;
             this.hittestResult      = hittestResult;
             e.Effects = this.ComputeDropEffects(e);
         }
         else
         {
             if (this.DragDropContext == null)
             {
                 return;
             }
             e.Effects = this.DragDropContext.Descriptor.ResultEffects;
         }
     }
     finally
     {
         this.UpdateFeedback(true, e);
         e.Handled = true;
     }
 }
Exemple #2
0
 private StructureViewDragDropHandler.HittestResult Hittest(Point position)
 {
     StructureViewDragDropHandler.HittestResult hittestResult = new StructureViewDragDropHandler.HittestResult();
     if (this.StructureView.TimelineItemManager != null)
     {
         double indentMultiplier = this.StructureView.IndentMultiplier;
         int    num = (int)Math.Floor((position.X - indentMultiplier) / this.StructureView.IndentMultiplier);
         IList <TimelineItem> list = (IList <TimelineItem>) this.StructureView.TimelineItemManager.ItemList;
         if (list != null)
         {
             for (int index = list.Count - 1; index >= 0; --index)
             {
                 TimelineItem timelineItem = list[index];
                 if (timelineItem != null && timelineItem.Depth <= num)
                 {
                     ElementTimelineItem elementTimelineItem = timelineItem as ElementTimelineItem;
                     bool flag = elementTimelineItem != null && elementTimelineItem.Element.IsContainer;
                     hittestResult.allowDropInside = flag || timelineItem.Depth <= num - 1;
                     hittestResult.candidateItem   = timelineItem;
                     break;
                 }
             }
         }
     }
     return(hittestResult);
 }
Exemple #3
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);
 }
Exemple #4
0
 public override void OnDragLeave(DragEventArgs e)
 {
     this.hittestResult = (StructureViewDragDropHandler.HittestResult)null;
     this.UpdateFeedback(false, (DragEventArgs)null);
     e.Handled = true;
     base.OnDragLeave(e);
 }
Exemple #5
0
 public override bool Equals(object obj)
 {
     StructureViewDragDropHandler.HittestResult hittestResult = obj as StructureViewDragDropHandler.HittestResult;
     if (hittestResult != null && hittestResult.candidateItem == this.candidateItem)
     {
         return(hittestResult.allowDropInside == this.allowDropInside);
     }
     return(false);
 }
Exemple #6
0
 public override void OnDragEnter(DragEventArgs e)
 {
     base.OnDragEnter(e);
     try
     {
         e.Effects               = DragDropEffects.None;
         this.lastModifierKeys   = Keyboard.Modifiers;
         this.lastAllowedEffects = e.AllowedEffects;
         this.hittestResult      = this.Hittest(e.GetPosition((IInputElement)this.StructureView));
         e.Effects               = this.ComputeDropEffects(e);
     }
     finally
     {
         this.UpdateFeedback(true, e);
         e.Handled = true;
     }
 }