Ejemplo n.º 1
0
        public override IDropAction CreateInstance(DragDropContext context)
        {
            this.CheckNullArgument((object)context, "context");
            TypeAsset result1 = (TypeAsset)null;

            if (DragSourceHelper.FirstDataOfType <TypeAsset>(context.Data, ref result1) && PlatformTypes.IsEffectType((ITypeId)result1.Type))
            {
                ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)result1, context);
                if (insertionPoint != null)
                {
                    return((IDropAction) new DropEffectAssetAction(result1, insertionPoint));
                }
            }
            DocumentNodeMarkerSortedList result2 = (DocumentNodeMarkerSortedList)null;

            if (DragSourceHelper.FirstDataOfType <DocumentNodeMarkerSortedList>(context.Data, ref result2) && result2.Count == 1)
            {
                DocumentNodeMarker marker = result2.MarkerAt(0);
                if (marker != null && marker.Node != null && PlatformTypes.IsEffectType((ITypeId)marker.Node.Type))
                {
                    SceneViewModel viewModel = context.Target.TimelineItemManager.ViewModel;
                    SceneNode      sceneNode = SceneNode.FromMarker <SceneNode>(marker, viewModel);
                    if (sceneNode != null)
                    {
                        ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)sceneNode, context);
                        if (insertionPoint != null)
                        {
                            return((IDropAction) new DropEffectSceneNodeAction(sceneNode, insertionPoint));
                        }
                    }
                }
            }
            return((IDropAction)null);
        }
Ejemplo n.º 2
0
 public TimelineDragDescriptor(DragDropContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     this.DropIndex         = -1;
     this.Context           = context;
     this.ResultDropEffects = this.Context.AllowedEffects;
 }
Ejemplo n.º 3
0
 protected ISceneInsertionPoint GetInsertionPoint(object data, DragDropContext context)
 {
     this.CheckNullArgument(data, "data");
     if (context.Target != null)
     {
         ISceneInsertionPoint insertionPoint = context.Target.GetInsertionPoint(data, context);
         if (insertionPoint != null)
         {
             return((ISceneInsertionPoint)SmartInsertionPoint.From(insertionPoint, context.Descriptor.DropIndex));
         }
     }
     return((ISceneInsertionPoint)null);
 }
Ejemplo n.º 4
0
        public override IDropAction CreateInstance(DragDropContext context)
        {
            this.CheckNullArgument((object)context, "context");
            DataSchemaNodePathCollection result = (DataSchemaNodePathCollection)null;

            if (DragSourceHelper.FirstDataOfType <DataSchemaNodePathCollection>(context.Data, ref result))
            {
                BindingSceneInsertionPoint insertionPoint = context.Target.GetInsertionPoint((object)result, context) as BindingSceneInsertionPoint;
                if (insertionPoint != null && insertionPoint.SceneNode != null)
                {
                    return((IDropAction) new DropBindingAction(result, insertionPoint));
                }
            }
            return((IDropAction)null);
        }
Ejemplo n.º 5
0
        public override IDropAction CreateInstance(DragDropContext context)
        {
            this.CheckNullArgument((object)context, "context");
            Asset result = (Asset)null;

            if (DragSourceHelper.FirstDataOfType <Asset>(context.Data, ref result))
            {
                ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)result, context);
                if (insertionPoint != null)
                {
                    return((IDropAction) new DropAssetAction(result, insertionPoint));
                }
            }
            return((IDropAction)null);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public override IDropAction CreateInstance(DragDropContext context)
        {
            this.CheckNullArgument((object)context, "context");
            DocumentNodeMarkerSortedList result = (DocumentNodeMarkerSortedList)null;

            if (DragSourceHelper.FirstDataOfType <DocumentNodeMarkerSortedList>(context.Data, ref result))
            {
                ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)result, context);
                if (insertionPoint != null)
                {
                    foreach (DocumentNodeMarker documentNodeMarker in result.Markers)
                    {
                        if (documentNodeMarker.Node != null && documentNodeMarker.Node.Type != null && !insertionPoint.CanInsert((ITypeId)documentNodeMarker.Node.Type))
                        {
                            return((IDropAction)null);
                        }
                    }
                    return((IDropAction) new DropMarkerListAction(result, insertionPoint));
                }
            }
            return((IDropAction)null);
        }
Ejemplo n.º 9
0
 public abstract IDropAction CreateInstance(DragDropContext context);
 public DataBindingInsertionPointCreator(TimelineItem targetItem, SceneNode node, IProperty targetProperty, DragDropContext context)
     : base(targetItem, node, context)
 {
     this.TargetProperty = targetProperty;
 }
 public DefaultTimelineItemInsertionPointCreator(TimelineItem targetItem, SceneNode node, DragDropContext context)
 {
     this.Item    = targetItem;
     this.Node    = node;
     this.Context = context;
 }