コード例 #1
0
 private IProperty GetContentPropertyFromDragDescriptor(TimelineDragDescriptor descriptor)
 {
     if (this.Context.Target != null)
     {
         if (descriptor.AllowBetween && this.Context.Target.SceneNode != null)
         {
             DocumentNode documentNode = this.Context.Target.SceneNode.DocumentNode;
             if (documentNode.Parent != null)
             {
                 if (documentNode.SitePropertyKey != null)
                 {
                     return(documentNode.SitePropertyKey);
                 }
                 return(documentNode.Parent.SitePropertyKey);
             }
         }
         else
         {
             if (this.Context.Target is ElementTimelineItem && this.Context.Target.SceneNode != null)
             {
                 return(this.Context.Target.SceneNode.InsertionTargetProperty);
             }
             ChildPropertyTimelineItem propertyTimelineItem = this.Context.Target as ChildPropertyTimelineItem;
             if (propertyTimelineItem != null)
             {
                 return(propertyTimelineItem.TargetProperty);
             }
         }
     }
     return((IProperty)null);
 }
コード例 #2
0
ファイル: DragDropContext.cs プロジェクト: radtek/Shopdrawing
 public DragDropContext(IDataObject data, TimelineItem target, TimelineDropEffects allowedEffects)
 {
     this.Data           = data;
     this.Target         = target;
     this.AllowedEffects = allowedEffects;
     this.Descriptor     = new TimelineDragDescriptor(this);
 }
コード例 #3
0
ファイル: DropAction`1.cs プロジェクト: radtek/Shopdrawing
 public bool CanDrop(TimelineDragDescriptor descriptor)
 {
     this.CheckNullArgument((object)descriptor, "descriptor");
     if (this.IsLockedOrAncestorLocked)
     {
         return(false);
     }
     return(this.OnQueryCanDrop(descriptor));
 }
コード例 #4
0
 protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
 {
     this.CheckNullArgument((object)descriptor, "descriptor");
     if (PlatformTypes.FrameworkTemplate.IsAssignableFrom((ITypeId)this.TargetNode.Type) || PlatformTypes.Style.IsAssignableFrom((ITypeId)this.TargetNode.Type))
     {
         return(false);
     }
     descriptor.DisableInBetween();
     return(base.OnQueryCanDrop(descriptor));
 }
コード例 #5
0
 protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
 {
     if (!this.SourceData.CanCreateInstance(this.InsertionPoint))
     {
         return(false);
     }
     descriptor.DisableCopy();
     descriptor.SetCreateIn(this.InsertionPoint);
     descriptor.TryReplace((object)this.SourceData, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection);
     return(descriptor.CanDrop);
 }
コード例 #6
0
        public static DragTipModel FromDescriptor(TimelineDragDescriptor descriptor)
        {
            DragTipModel dragTipModel = (DragTipModel)null;

            if (descriptor != null)
            {
                dragTipModel = new DragTipModel();
                dragTipModel.SetEffect(descriptor);
                dragTipModel.SetSource(descriptor);
            }
            return(dragTipModel);
        }
コード例 #7
0
        protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
        {
            DataBindingDragDropModel dragFeedback = this.DragFeedback;

            if (dragFeedback == null || dragFeedback.DropFlags == DataBindingDragDropFlags.None)
            {
                return(false);
            }
            descriptor.DisableCopy();
            descriptor.SetDataBindingTo((ISceneInsertionPoint)this.BindingInsertionPoint);
            descriptor.UserData = (object)dragFeedback;
            return(true);
        }
コード例 #8
0
        public static IDropAction CreateInstance(DragDropContext context)
        {
            TimelineDragDescriptor timelineDragDescriptor = context.Descriptor.Clone();

            foreach (IDropActionFactory dropActionFactory in (IEnumerable <IDropActionFactory>)DropActionFactory.factoryList)
            {
                IDropAction instance = dropActionFactory.CreateInstance(context);
                if (instance != null)
                {
                    return(instance);
                }
                context.Descriptor = timelineDragDescriptor.Clone();
            }
            context.Descriptor.DisableDrop();
            return((IDropAction)null);
        }
コード例 #9
0
        protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
        {
            DocumentNodeMarkerSortedList sourceData = this.SourceData;

            if (sourceData.Count > 1 && !this.CanAddMultipleItems)
            {
                return(false);
            }
            foreach (SceneNode node in SceneNode.FromMarkerList <SceneNode>((DocumentNodeMarkerSortedListBase)sourceData, this.ViewModel))
            {
                if (!this.CanDrop(node, descriptor))
                {
                    return(false);
                }
            }
            return(descriptor.CanDrop);
        }
コード例 #10
0
        protected SceneElement GetDropTargetInfo(TimelineDropEffects dropEffects, TimelineDragDescriptor descriptor)
        {
            SceneElement sceneElement1 = this.Element;

            if (sceneElement1 == null)
            {
                return((SceneElement)null);
            }
            descriptor.DropIndex = -1;
            int          num           = 0;
            SceneElement sceneElement2 = (SceneElement)null;
            bool         flag          = false;

            if ((dropEffects & TimelineDropEffects.Before) != TimelineDropEffects.None)
            {
                sceneElement1 = this.Element.VisualElementAncestor;
                sceneElement2 = this.Element.VisualElementAncestor;
                if (this.Item.IsExpanded && this.Item.HasActiveChild)
                {
                    sceneElement1            = this.Element;
                    sceneElement2            = this.Element;
                    descriptor.RelativeDepth = 1;
                }
                num  = 1;
                flag = true;
            }
            else if ((dropEffects & TimelineDropEffects.After) != TimelineDropEffects.None)
            {
                sceneElement1 = this.Element.VisualElementAncestor;
                sceneElement2 = this.Element.VisualElementAncestor;
                flag          = true;
            }
            if (flag && sceneElement2 != null)
            {
                ISceneNodeCollection <SceneNode> collectionForProperty = sceneElement2.GetCollectionForProperty((IPropertyId)this.GetContentPropertyFromDragDescriptor(descriptor));
                if (collectionForProperty != null)
                {
                    descriptor.DropIndex = collectionForProperty.IndexOf((SceneNode)this.Element) + num;
                }
            }
            if (!this.Element.ViewModel.ActiveEditingContainer.IsAncestorOf((SceneNode)sceneElement1))
            {
                sceneElement1 = (SceneElement)null;
            }
            return(sceneElement1);
        }
コード例 #11
0
 private void SetEffect(TimelineDragDescriptor descriptor)
 {
     this.DropEffectId = DropEffectId.None;
     this.TargetName   = string.Empty;
     if (descriptor.IsNestingContents)
     {
         if (descriptor.IsCreating)
         {
             this.DropEffectId = DropEffectId.CreateAsParent;
         }
         else if (descriptor.AllowCopy)
         {
             this.DropEffectId = DropEffectId.CopyAsParent;
         }
         else if (descriptor.AllowMove)
         {
             this.DropEffectId = DropEffectId.MoveAsParent;
         }
         this.TargetName = this.GetDisplayName(descriptor.ReplacedChild);
     }
     else if (descriptor.IsReplacingChild)
     {
         this.DropEffectId = !descriptor.AllowCopy ? DropEffectId.Replace : DropEffectId.ReplaceAsCopy;
         this.TargetName   = this.GetDisplayName(descriptor.ReplacedChild);
     }
     else if (descriptor.IsCreating)
     {
         this.DropEffectId = DropEffectId.Create;
         this.TargetName   = this.GetDisplayName(descriptor.TargetParent);
     }
     else if (descriptor.AllowCopy)
     {
         this.DropEffectId = DropEffectId.Copy;
         this.TargetName   = this.GetDisplayName(descriptor.TargetParent);
     }
     else
     {
         if (!descriptor.AllowMove)
         {
             return;
         }
         this.DropEffectId = DropEffectId.Move;
         this.TargetName   = this.GetDisplayName(descriptor.TargetParent);
     }
 }
コード例 #12
0
 protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
 {
     descriptor.DisableInBetween();
     if (!this.InsertionPoint.CanInsert((ITypeId)this.SourceData.Type))
     {
         return(false);
     }
     if (descriptor.AllowCopy)
     {
         descriptor.SetCopyInto(this.InsertionPoint);
     }
     else
     {
         descriptor.SetMoveInto(this.InsertionPoint);
     }
     descriptor.TryReplace((object)this.SourceData, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection);
     return(true);
 }
コード例 #13
0
        private void SetSource(TimelineDragDescriptor descriptor)
        {
            DocumentNodeMarkerSortedList result1 = (DocumentNodeMarkerSortedList)null;

            if (DragSourceHelper.FirstDataOfType <DocumentNodeMarkerSortedList>(descriptor.SourceObject, ref result1))
            {
                if (result1.Count == 1 && descriptor.TargetItem != null)
                {
                    if (!this.SetSource((object)descriptor.TargetItem.TimelineItemManager.ViewModel.GetSceneNode(result1.MarkerAt(0).Node)))
                    {
                        ;
                    }
                }
                else
                {
                    this.SourceName = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.DragMultipleItemsFormat, new object[1]
                    {
                        (object)result1.Count
                    });
                    this.SourceType = string.Empty;
                }
            }
            else
            {
                Asset result2 = (Asset)null;
                if (DragSourceHelper.FirstDataOfType <Asset>(descriptor.SourceObject, ref result2) && this.SetSource((object)result2))
                {
                    return;
                }
                DataSchemaNodePathCollection result3 = (DataSchemaNodePathCollection)null;
                if (DragSourceHelper.FirstDataOfType <DataSchemaNodePathCollection>(descriptor.SourceObject, ref result3))
                {
                    this.SetDataBinding(descriptor.UserData as DataBindingDragDropModel);
                }
                else
                {
                    this.SourceName = this.SourceType = string.Empty;
                }
            }
        }
コード例 #14
0
        private bool CanDrop(SceneNode node, TimelineDragDescriptor descriptor)
        {
            SceneElement sceneElement;

            if (!descriptor.AllowCopy && !descriptor.AllowMove || ((sceneElement = node as SceneElement) == null || !this.InsertionPoint.CanInsert((ITypeId)sceneElement.Type)))
            {
                return(false);
            }
            if (descriptor.AllowCopy)
            {
                descriptor.SetCopyInto(this.InsertionPoint);
            }
            else
            {
                if (sceneElement.IsAncestorOf(this.TargetNode))
                {
                    return(false);
                }
                descriptor.SetMoveInto(this.InsertionPoint);
            }
            descriptor.TryReplace((object)sceneElement, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection);
            return(true);
        }
コード例 #15
0
        protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
        {
            descriptor.DisableInBetween();
            if (!this.InsertionPoint.CanInsert((ITypeId)this.SourceData.Type))
            {
                return(false);
            }
            if (descriptor.AllowCopy)
            {
                descriptor.SetCopyInto(this.InsertionPoint);
            }
            else
            {
                descriptor.SetMoveInto(this.InsertionPoint);
            }
            DocumentNodePath valueAsDocumentNode = this.TargetNode.GetLocalValueAsDocumentNode(Base2DElement.EffectProperty);

            if (valueAsDocumentNode != null && valueAsDocumentNode.Node == this.SourceData.DocumentNode)
            {
                return(false);
            }
            descriptor.TryReplace((object)this.SourceData, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection);
            return(true);
        }
コード例 #16
0
 protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
 {
     descriptor.DisableInBetween();
     return(base.OnQueryCanDrop(descriptor));
 }
コード例 #17
0
ファイル: DropAction`1.cs プロジェクト: radtek/Shopdrawing
 protected virtual bool OnQueryCanDrop(TimelineDragDescriptor descriptor)
 {
     descriptor.DisableDrop();
     return(false);
 }