private TreeViewItem FindTreeViewItemUnderTreeViewItemByModelName(TreeViewItem tvi, string modelName)
        {
            TreeViewItem treeViewItemRet = null;

            if (tvi != null)
            {
                AnimationElement model = tvi.DataContext as AnimationElement;
                if (model.Name == modelName)
                {
                    return(tvi);
                }
                else if (tvi.Items != null)
                {
                    for (int i = 0; i < tvi.Items.Count; i++)
                    {
                        TreeViewItem item         = tvi.ItemContainerGenerator.ContainerFromItem(tvi.Items[i]) as TreeViewItem;
                        var          treeViewItem = FindTreeViewItemUnderTreeViewItemByModelName(item, modelName);
                        if (treeViewItem != null)
                        {
                            treeViewItemRet = treeViewItem;
                            break;
                        }
                    }
                }
            }
            return(treeViewItemRet);
        }
 private void StartDrag(TreeView tv, MouseEventArgs e)
 {
     isDragging = true;
     try
     {
         // Get the dragged ListViewItem
         TreeView     treeView     = tv as TreeView;
         TreeViewItem treeViewItem =
             ControlUtilities.FindAncestor <TreeViewItem>((DependencyObject)e.OriginalSource);
         if (treeViewItem != null)
         {
             // Find the data behind the ListViewItem
             //AnimationElement elementBehind = (AnimationElement)treeView.ItemContainerGenerator.ItemFromContainer(treeViewItem);
             AnimationElement element = (AnimationElement)treeView.SelectedItem;
             // Initialize the drag & drop operation
             DataObject dragData = new DataObject(ANIMATION_DRAG_KEY, element);
             DragDrop.DoDragDrop(treeViewItem, dragData, DragDropEffects.Move);
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
         isDragging = false;
     }
 }
        private void treeViewAnimations_PreviewDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(ANIMATION_DRAG_KEY))
            {
                TreeViewItem itemNode;
                FindDropTarget((TreeView)sender, out itemNode, e);

                if (itemNode != null)
                {
                    AnimationElement dropAnimationElement = (itemNode != null && itemNode.IsVisible ? itemNode.DataContext as AnimationElement : null);
                    var draggedObject = e.Data.GetData(ANIMATION_DRAG_KEY);
                    try
                    {
                        if (draggedObject is ReferenceResource)
                        {
                            // Drag drop of Reference Resource
                            this.viewModel.MoveReferenceResourceAfterAnimationElement(draggedObject as ReferenceResource, dropAnimationElement);
                        }
                        else
                        {
                            // Drag drop of animations
                            this.viewModel.MoveSelectedAnimationElementAfter(dropAnimationElement);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Exemple #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            swtCriticalBugs.SetAnimationElementsOn(
                AnimationElement.TextColor(lblCriticalBugs, UIColor.White),
                AnimationElement.TextColor(lblCriticalBugsDescription, UIColor.White)
                );

            swtCriticalBugs.SetAnimationElementsOff(
                AnimationElement.TextColor(lblCriticalBugs, "514F52".ToUIColor()),
                AnimationElement.TextColor(lblCriticalBugsDescription, "514F52".ToUIColor())
                );

            swtCriticalBugs.OnCompleted += delegate
            {
                imgCriticalBugIcon.Image     = imgCriticalBugIcon.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                imgCriticalBugIcon.TintColor = UIColor.White;
            };

            swtCriticalBugs.OffCompleted += delegate
            {
                imgCriticalBugIcon.Image     = imgCriticalBugIcon.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                imgCriticalBugIcon.TintColor = BeerDrinkin.Helpers.Colours.Blue.ToNative();
            };
        }
        private AnimationElement cloneAndPaste(AnimationSequencer destinationSequence)
        {
            AnimationElement clonedElement = null;

            if (currentClipboardObject is AnimationElement)
            {
                var cloningElement = currentClipboardObject as AnimationElement;
                clonedElement = cloningElement.Clone(cloningElement.Target);

                destinationSequence.InsertElement(clonedElement);
            }
            else
            {
                var cloningAbility           = currentClipboardObject as AnimatedAbility;
                AnimationSequencer sequencer = cloningAbility.Clone() as AnimationSequencer;

                AnimatedCharacter target = null;
                if (destinationSequence is AnimatedAbility)
                {
                    target = (destinationSequence as AnimatedAbility).Target;
                }
                else
                {
                    target = (destinationSequence as SequenceElement).Target;
                }

                SequenceElementImpl sequenceElement = new HeroVirtualTabletop.AnimatedAbility.SequenceElementImpl(sequencer, target);
                sequenceElement.Type = sequencer.Type;
                sequenceElement.Name = "Sequence: " + sequenceElement.Type.ToString();
                clonedElement        = sequenceElement;

                destinationSequence.InsertElement(sequenceElement);
            }
            return(clonedElement);
        }
        private void viewModel_ExpansionUpdateNeeded(object sender, CustomEventArgs <ExpansionUpdateEvent> e)
        {
            SequenceElement      sequenceElement = sender as SequenceElement;
            DependencyObject     dObject         = null;
            ExpansionUpdateEvent updateEvent     = e.Value;

            if (updateEvent == ExpansionUpdateEvent.Filter)
            {
                ExpandMatchedNode(sender); // Keeping way open for future filtering feature
            }
            else
            {
                if (this.viewModel.SelectedAnimationElementRoot != null && this.viewModel.SelectedAnimationParent != null)
                {
                    if (this.viewModel.SelectedAnimationElement is SequenceElement) // Sequence within a sequence
                    {
                        TreeViewItem item = treeViewAnimations.ItemContainerGenerator.ContainerFromItem(this.viewModel.SelectedAnimationElementRoot) as TreeViewItem;
                        dObject = FindTreeViewItemUnderTreeViewItemByModelName(item, this.viewModel.SelectedAnimationElement.Name);
                    }
                    else if (this.viewModel.SelectedAnimationElementRoot.Name == this.viewModel.SelectedAnimationParent.Name) // They are the same element
                    {
                        dObject = treeViewAnimations.GetItemFromSelectedObject(this.viewModel.SelectedAnimationParent);
                    }
                    else
                    {
                        TreeViewItem item = treeViewAnimations.ItemContainerGenerator.ContainerFromItem(this.viewModel.SelectedAnimationElementRoot) as TreeViewItem;
                        dObject = FindTreeViewItemUnderTreeViewItemByModelName(item, this.viewModel.SelectedAnimationParent.Name);
                    }
                }
                else if (this.viewModel.SelectedAnimationElementRoot == null && this.viewModel.SelectedAnimationElement is SequenceElement)
                {
                    dObject = treeViewAnimations.GetItemFromSelectedObject(this.viewModel.SelectedAnimationElement);
                }
                TreeViewItem tvi = dObject as TreeViewItem;
                if (tvi != null)
                {
                    AnimationElement model = tvi.DataContext as AnimationElement;
                    if (tvi.Items != null && tvi.Items.Count > 0)
                    {
                        if (updateEvent != ExpansionUpdateEvent.Delete)
                        {
                            tvi.IsExpanded = true;
                        }
                        else
                        {
                            UpdateExpansions(tvi);
                        }
                    }
                    else
                    {
                        tvi.IsExpanded = false;
                    }
                }
            }
        }
        private AnimationElement cutAndPaste(AnimationSequencer destinationSequence)
        {
            object[]           clipboardObj   = this.currentClipboardObject as object[];
            AnimationElement   cutElement     = clipboardObj[0] as AnimationElement;
            AnimationSequencer parentSequence = clipboardObj[1] as AnimationSequencer;

            parentSequence.RemoveElement(cutElement);
            destinationSequence.InsertElement(cutElement);

            return(cutElement);
        }
        private void viewModel_AnimationElementDraggedFromGrid(object sender, EventArgs e)
        {
            AnimationElement modelToSelect = sender as AnimationElement;
            TreeViewItem     tvi           = itemNodeParent; // Got the selected treeviewitem

            if (tvi != null)
            {
                AnimationElement model = tvi.DataContext as AnimationElement;
                if (tvi.Items != null)
                {
                    tvi.IsExpanded = true;
                    tvi.UpdateLayout();
                    for (int i = 0; i < tvi.Items.Count; i++)
                    {
                        TreeViewItem item = tvi.ItemContainerGenerator.ContainerFromItem(tvi.Items[i]) as TreeViewItem;
                        if (item != null)
                        {
                            model = item.DataContext as AnimationElement;
                            if (model.Name == modelToSelect.Name)
                            {
                                item.IsSelected = true;
                                item.UpdateLayout();
                                this.viewModel.SelectedAnimationElement = model as AnimationElement;
                                this.viewModel.SelectedAnimationParent  = tvi.DataContext as AnimationElement;
                                TreeViewItem rootItem = GetRootTreeViewItemParent(item);
                                if (rootItem != null)
                                {
                                    this.viewModel.SelectedAnimationElementRoot = rootItem.DataContext as AnimationElement;
                                    if (this.viewModel.SelectedAnimationElementRoot is SequenceElement)
                                    {
                                        this.viewModel.IsSequenceAbilitySelected = true;
                                    }
                                    else
                                    {
                                        this.viewModel.IsSequenceAbilitySelected = false;
                                    }
                                }
                                else
                                {
                                    this.viewModel.SelectedAnimationElementRoot = null;
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// 获取Spine动画中的动画名称
        /// </summary>
        /// <param name="key">键</param>
        /// <returns></returns>
        public string GetAnimationName(string key)
        {
            string languageShortName = this.GetLanguage();

            if (this.resConfigs != null && this.resConfigs.ContainsKey(languageShortName) &&
                this.resConfigs[languageShortName].AnimationElements != null)
            {
                AnimationElement animationElement = this.resConfigs[languageShortName].AnimationElements.Find(t => t.Key == key);
                GuLog.Debug(string.Format("<><I18NConfig.GetAnimationName>Key: {0}, FoundAnimationName: {1}", key, animationElement != null ? animationElement.Value : key));
                return(animationElement != null ? animationElement.Value : key);
            }
            else
            {
                GuLog.Debug(string.Format("<><I18NConfig.GetAnimationName>Key: {0}, DefaultAnimationName: {1}", key, key));
                return(key);
            }
        }
        public AnimationElement PasteFromClipboard(AnimationSequencer destinationSequence)
        {
            AnimationElement pastedMember = null;

            switch (this.CurrentClipboardAction)
            {
            case ClipboardAction.Clone:
                pastedMember = cloneAndPaste(destinationSequence);
                break;

            case ClipboardAction.Cut:
                pastedMember = cutAndPaste(destinationSequence);
                break;
            }
            this.CurrentClipboardAction = ClipboardAction.None;
            this.currentClipboardObject = null;

            return(pastedMember);
        }
Exemple #11
0
        private void treeViewAnimations_PreviewDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(Constants.ANIMATION_DRAG_KEY))
            {
                TreeViewItem itemNode;
                FindDropTarget((TreeView)sender, out itemNode, e);

                if (itemNode != null)
                {
                    AnimationElement dropAnimationElement       = (itemNode != null && itemNode.IsVisible ? itemNode.DataContext as AnimationElement : null);
                    AnimationElement dragAnimationElement       = e.Data.GetData(Constants.ANIMATION_DRAG_KEY) as AnimationElement;
                    SequenceElement  dropAnimationElementParent = null;
                    if (dropAnimationElement is SequenceElement)
                    {
                        itemNodeParent             = itemNode;
                        dropAnimationElementParent = dropAnimationElement as SequenceElement;
                    }
                    else
                    {
                        itemNodeParent             = GetImmediateTreeViewItemParent(itemNode);
                        dropAnimationElementParent = itemNodeParent != null ? itemNodeParent.DataContext as SequenceElement : null;
                    }
                    try
                    {
                        if (dragAnimationElement is AnimatedAbility)
                        {
                            // Drag drop of Reference Ability
                            this.viewModel.MoveReferenceAbilityToAnimationElements(dragAnimationElement as AnimatedAbility, dropAnimationElementParent, dropAnimationElement.Order);
                        }
                        else
                        {
                            // Drag drop of animations
                            this.viewModel.MoveSelectedAnimationElement(dropAnimationElementParent, dropAnimationElement.Order);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Exemple #12
0
        public static object GetCurrentSelectedAnimationInAnimationCollection(Object tv, out AnimationElement animationElement)
        {
            AnimationElement selectedAnimationElement = null;

            animationElement = null;
            TreeView treeView = tv as TreeView;

            if (treeView != null && treeView.SelectedItem != null)
            {
                DependencyObject dObject = treeView.GetItemFromSelectedObject(treeView.SelectedItem);
                TreeViewItem     tvi     = dObject as TreeViewItem; // got the selected treeviewitem
                if (tvi != null)
                {
                    selectedAnimationElement = tvi.DataContext as AnimationElement;
                }
                dObject = VisualTreeHelper.GetParent(tvi); // got the immediate parent
                tvi     = dObject as TreeViewItem;         // now get first treeview item parent
                while (tvi == null)
                {
                    dObject = VisualTreeHelper.GetParent(dObject);
                    tvi     = dObject as TreeViewItem;
                    if (tvi == null)
                    {
                        var tView = dObject as TreeView;
                        if (tView != null)
                        {
                            break;
                        }
                    }
                    else
                    {
                        animationElement = tvi.DataContext as AnimationElement;
                    }
                }
            }

            return(selectedAnimationElement);
        }
Exemple #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // blue switch logging
            blueSwitch.OnCompleted += delegate {
                Console.WriteLine("Animation On");
            };
            blueSwitch.OffCompleted += delegate {
                Console.WriteLine("Animation Off");
            };

            // the blue switch effects
            blueSwitch.SetAnimationElementsOn(
                AnimationElement.TextColor(blueLabel, UIColor.White),
                AnimationElement.TintColor(infoButton, UIColor.White));
            blueSwitch.SetAnimationElementsOff(
                AnimationElement.TextColor(blueLabel, UIColor.Black),
                AnimationElement.TintColor(infoButton, UIColor.Black));

            // the blue switch events
            blueSwitch.OnCompleted += delegate {
                UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            };
            blueSwitch.OffCompleted += delegate {
                UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
            };

            // the green switch effects
            greenSwitch.SetAnimationElementsOn(
                AnimationElement.Layer(greenView.Layer, "backgroundColor", UIColor.Clear.CGColor, UIColor.White.CGColor)
                );
            greenSwitch.SetAnimationElementsOff(
                AnimationElement.Layer(greenView.Layer, "backgroundColor", UIColor.White.CGColor, UIColor.Clear.CGColor)
                );
        }
 public abstract UIAnimation Install(GameObject gameObject, AnimationElement element, IReadOnlyLayoutContext context);
        private void viewModel_AnimationAdded(object sender, CustomEventArgs <bool> e)
        {
            AnimationElement modelToSelect = sender as AnimationElement;

            if (sender == null) // Need to unselect
            {
                DependencyObject dObject = treeViewAnimations.GetItemFromSelectedObject(treeViewAnimations.SelectedItem);
                TreeViewItem     tvi     = dObject as TreeViewItem; // Got the selected treeviewitem
                if (tvi != null)
                {
                    tvi.IsSelected = false;
                    this.viewModel.SelectedAnimationElementRoot = null;
                }
            }
            else
            {
                bool    itemFound = false;
                TextBox txtBox    = null;
                treeViewAnimations.UpdateLayout();
                if (sender is AnimationElement)
                {
                    if (this.viewModel.SelectedAnimationElement == null || !(this.viewModel.SelectedAnimationElement is SequenceElement || this.viewModel.SelectedAnimationParent is SequenceElement)) // A new animation has been added to the collection
                    {
                        for (int i = 0; i < treeViewAnimations.Items.Count; i++)
                        {
                            TreeViewItem item = treeViewAnimations.ItemContainerGenerator.ContainerFromItem(treeViewAnimations.Items[i]) as TreeViewItem;
                            if (item != null)
                            {
                                var model = item.DataContext as AnimationElement;
                                if (model.Name == modelToSelect.Name)
                                {
                                    item.IsSelected = true;
                                    itemFound       = true;
                                    txtBox          = FindTextBoxInTemplate(item);
                                    this.viewModel.SelectedAnimationElement     = model as AnimationElement;
                                    this.viewModel.SelectedAnimationParent      = null;
                                    this.viewModel.SelectedAnimationElementRoot = null;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (!itemFound && (this.viewModel.SelectedAnimationElement is SequenceElement || this.viewModel.SelectedAnimationParent is SequenceElement)) // Added somewhere in nested animation
                {
                    DependencyObject dObject = null;
                    if (this.viewModel.SelectedAnimationElementRoot != null && this.viewModel.SelectedAnimationParent != null)
                    {
                        if (this.viewModel.SelectedAnimationElement is SequenceElement) // Sequence within a sequence
                        {
                            TreeViewItem item = treeViewAnimations.ItemContainerGenerator.ContainerFromItem(this.viewModel.SelectedAnimationElementRoot) as TreeViewItem;
                            dObject = FindTreeViewItemUnderTreeViewItemByModelName(item, this.viewModel.SelectedAnimationElement.Name);
                        }
                        else if (this.viewModel.SelectedAnimationElementRoot.Name == this.viewModel.SelectedAnimationParent.Name) // They are the same element
                        {
                            dObject = treeViewAnimations.GetItemFromSelectedObject(this.viewModel.SelectedAnimationParent);
                        }
                        else
                        {
                            TreeViewItem item = treeViewAnimations.ItemContainerGenerator.ContainerFromItem(this.viewModel.SelectedAnimationElementRoot) as TreeViewItem;
                            dObject = FindTreeViewItemUnderTreeViewItemByModelName(item, this.viewModel.SelectedAnimationParent.Name);
                        }
                    }
                    else if (this.viewModel.SelectedAnimationElementRoot == null && this.viewModel.SelectedAnimationElement is SequenceElement)
                    {
                        dObject = treeViewAnimations.GetItemFromSelectedObject(this.viewModel.SelectedAnimationElement);
                    }
                    TreeViewItem tvi = dObject as TreeViewItem; // Got the selected treeviewitem
                    if (tvi != null)
                    {
                        AnimationElement model = tvi.DataContext as AnimationElement;
                        if (tvi.Items != null)
                        {
                            tvi.IsExpanded = true;
                            tvi.UpdateLayout();
                            for (int i = 0; i < tvi.Items.Count; i++)
                            {
                                TreeViewItem item = tvi.ItemContainerGenerator.ContainerFromItem(tvi.Items[i]) as TreeViewItem;
                                if (item != null)
                                {
                                    model = item.DataContext as AnimationElement;
                                    if (model.Name == modelToSelect.Name)
                                    {
                                        item.IsSelected = true;
                                        itemFound       = true;
                                        item.UpdateLayout();
                                        txtBox = FindTextBoxInTemplate(item);
                                        this.viewModel.SelectedAnimationElement = model as AnimationElement;
                                        this.viewModel.SelectedAnimationParent  = tvi.DataContext as AnimationElement;
                                        if (this.viewModel.SelectedAnimationElementRoot == null)
                                        {
                                            this.viewModel.SelectedAnimationElementRoot = tvi.DataContext as AnimationElement;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                if (txtBox != null && this.viewModel.SelectedAnimationElement is PauseElement)
                {
                    if (!(e != null && e.Value == false)) // to avoid renaming in case of cut-paste or drag-drop
                    {
                        this.viewModel.EnterAnimationElementEditMode(txtBox);
                    }
                }
            }
        }
Exemple #16
0
        /************************************************私  有  方  法************************************************/
        //读取语言配置文件
        private void Parser(WWW www)
        {
            m_LoadOk = true;
            GuLog.Debug("ResConfigPath WWW::" + www.error);

            if (www.isDone && (www.error == null || www.error.Length == 0))
            {
                SecurityParser xmlDoc = new SecurityParser();
                GuLog.Debug("ResConfigPath" + www.text);

                xmlDoc.LoadXml(www.text);
                ArrayList allNodes = xmlDoc.ToXml().Children;
                foreach (SecurityElement xeResConfigs in allNodes)
                {     //根节点
                    if (xeResConfigs.Tag == "ResConfigs")
                    { //ResConfigs节点
                        ArrayList resConfigNodes = xeResConfigs.Children;
                        foreach (SecurityElement xeResConfig in resConfigNodes)
                        {//ResConfig节点
                            if (xeResConfig.Tag == "ResConfig")
                            {
                                string language = xeResConfig.Attribute("Language");
                                if (this.LanConfig.IsValid(language))
                                {
                                    ResConfig resConfig = new ResConfig()
                                    {
                                        Language = language
                                    };
                                    ArrayList elementNodes = xeResConfig.Children;
                                    foreach (SecurityElement xeText in elementNodes)
                                    {
                                        if (xeText.Tag == "Text")
                                        {//TextElement节点
                                            TextElement textElement = new TextElement()
                                            {
                                                Key = xeText.Attribute("Key"), Value = xeText.Attribute("Value")
                                            };
                                            resConfig.TextElements.Add(textElement);
                                        }
                                        else if (xeText.Tag == "Image")
                                        {//ImageElement节点
                                            ImageElement imageElement = new ImageElement()
                                            {
                                                Key = xeText.Attribute("Key"), Value = xeText.Attribute("Value")
                                            };
                                            resConfig.ImageElements.Add(imageElement);
                                        }
                                        else if (xeText.Tag == "Animation")
                                        {//AnimationElement节点
                                            AnimationElement animationElement = new AnimationElement()
                                            {
                                                Key = xeText.Attribute("Key"), Value = xeText.Attribute("Value")
                                            };
                                            resConfig.AnimationElements.Add(animationElement);
                                        }
                                        else if (xeText.Tag == "Audio")
                                        {//AudioElement节点
                                            AudioElement audioElement = new AudioElement()
                                            {
                                                Key = xeText.Attribute("Key"), Value = xeText.Attribute("Value")
                                            };
                                            resConfig.AudioElements.Add(audioElement);
                                        }
                                    }
                                    this.resConfigs.Add(language, resConfig);
                                }
                                else
                                {
                                    GuLog.Error(string.Format("----I18NConfig.Parser----ResConfigs.Language: {0}", language));
                                }
                            }
                        }
                    }
                }
                //GuLog.Debug(string.Format("----I18NConfig.Parser----I18NConfig.xml: {0}", www.text));
            }
        }
 public void InsertElementAfter(AnimationElement toInsert, AnimationElement moveAfter)
 {
     Sequencer.InsertElementAfter(toInsert, moveAfter);
     NotifyOfPropertyChange(() => AnimationElements);
 }
 public void RemoveElement(AnimationElement animationElement)
 {
     Sequencer.RemoveElement(animationElement);
     NotifyOfPropertyChange(() => AnimationElements);
 }
 public void CopyToClipboard(AnimationElement animationElement)
 {
     CurrentClipboardAction = ClipboardAction.Clone;
     currentClipboardObject = animationElement;
 }
 public void CutToClipboard(AnimationElement animationElement, AnimationSequencer sourceSequence)
 {
     this.CurrentClipboardAction = ClipboardAction.Cut;
     this.currentClipboardObject = new object[] { animationElement, sourceSequence };
 }
        public bool CheckPasteEligibilityFromClipboard(AnimationSequencer destinationSequence)
        {
            bool canPaste = false;

            switch (this.CurrentClipboardAction)
            {
            case ClipboardAction.Clone:
                if (this.currentClipboardObject != null)
                {
                    if (this.currentClipboardObject is AnimationSequencer)
                    {
                        AnimationSequencer      seqElement  = this.currentClipboardObject as AnimationSequencer;
                        List <AnimationElement> elementList = AnimationSequencerImpl.GetFlattenedAnimationList(seqElement.AnimationElements);
                        if (!(elementList.Where((an) => { return(an.AnimationElementType == AnimationElementType.Reference); }).Any((an) => { return((an as ReferenceElement).Reference?.Ability == destinationSequence); })))
                        {
                            canPaste = true;
                        }
                    }
                    else if (this.currentClipboardObject is ReferenceElement)
                    {
                        ReferenceElement refAbility = this.currentClipboardObject as ReferenceElement;
                        if (refAbility.Reference?.Ability == destinationSequence)
                        {
                            canPaste = false;
                        }
                        else if (refAbility.Reference?.Ability?.AnimationElements != null && refAbility.Reference?.Ability?.AnimationElements.Count > 0)
                        {
                            bool refexists = false;
                            if (refAbility.Reference.Ability.AnimationElements.Contains(destinationSequence as AnimationElement))
                            {
                                refexists = true;
                            }
                            List <AnimationElement> elementList = AnimationSequencerImpl.GetFlattenedAnimationList(refAbility.Reference.Ability.AnimationElements);
                            if (elementList.Where((an) => { return(an.AnimationElementType == AnimationElementType.Reference); }).Any((an) => { return((an as ReferenceElement).Reference.Ability == destinationSequence); }))
                            {
                                refexists = true;
                            }
                            if (!refexists)
                            {
                                canPaste = true;
                            }
                        }
                        else
                        {
                            canPaste = true;
                        }
                    }
                    else
                    {
                        canPaste = true;
                    }
                }
                break;

            case ClipboardAction.Cut:
                if (this.currentClipboardObject != null)
                {
                    object[]           clipObj = this.currentClipboardObject as object[];
                    AnimationElement   clipboardAnimationElement   = clipObj[0] as AnimationElement;
                    AnimationSequencer clipboardAnimationSequencer = clipObj[1] as AnimationSequencer;
                    if (clipboardAnimationElement is SequenceElement)
                    {
                        SequenceElement         seqElement  = clipboardAnimationElement as SequenceElement;
                        List <AnimationElement> elementList = AnimationSequencerImpl.GetFlattenedAnimationList(seqElement.AnimationElements);
                        if (!(elementList.Where((an) => { return(an.AnimationElementType == AnimationElementType.Reference); }).Any((an) => { return((an as ReferenceElement).Reference.Ability == destinationSequence); })))
                        {
                            canPaste = true;
                        }
                    }
                    else if (clipboardAnimationElement is ReferenceElement)
                    {
                        ReferenceElement refAbility = clipboardAnimationElement as ReferenceElement;
                        if (refAbility.Reference?.Ability == destinationSequence)
                        {
                            canPaste = false;
                        }
                        else if (refAbility.Reference?.Ability?.AnimationElements != null && refAbility.Reference?.Ability?.AnimationElements.Count > 0)
                        {
                            bool refexists = false;
                            if (refAbility.Reference.Ability.AnimationElements.Contains(destinationSequence as AnimationElement))
                            {
                                refexists = true;
                            }
                            List <AnimationElement> elementList = AnimationSequencerImpl.GetFlattenedAnimationList(refAbility.Reference.Ability.AnimationElements);
                            if (elementList.Where((an) => { return(an.AnimationElementType == AnimationElementType.Reference); }).Any((an) => { return((an as ReferenceElement).Reference.Ability == destinationSequence); }))
                            {
                                refexists = true;
                            }
                            if (!refexists)
                            {
                                canPaste = true;
                            }
                        }
                        else
                        {
                            canPaste = true;
                        }
                    }
                    else
                    {
                        canPaste = true;
                    }
                }
                break;
            }
            return(canPaste);
        }