VixenApplication.ConfigElements.pasteNodesToolStripMenuItem_Click C# (CSharp) Метод

pasteNodesToolStripMenuItem_Click() приватный Метод

private pasteNodesToolStripMenuItem_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
Результат void
        private void pasteNodesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_clipboardNodes == null)
                return;

            ElementNode destinationNode = null;
            TreeNode selectedTreeNode = multiSelectTreeviewElementsGroups.SelectedNode;

            if (selectedTreeNode != null)
                destinationNode = selectedTreeNode.Tag as ElementNode;

            IEnumerable<ElementNode> invalidNodesForTarget;
            if (destinationNode == null)
                invalidNodesForTarget = VixenSystem.Nodes.InvalidRootNodes;
            else
                invalidNodesForTarget = destinationNode.InvalidChildren();

            IEnumerable<ElementNode> invalidSourceNodes = invalidNodesForTarget.Intersect(_clipboardNodes);
            if (invalidSourceNodes.Count() > 0) {
                SystemSounds.Asterisk.Play();
            } else {
                // Check to see if the new parent node would be 'losing' the Element (ie. becoming a
                // group instead of a leaf node with a element/patches). Prompt the user first.
                if (CheckIfNodeWillLosePatches(destinationNode))
                    return;

                foreach (ElementNode cn in _clipboardNodes) {
                    VixenSystem.Nodes.AddChildToParent(cn, destinationNode);
                }

                if (selectedTreeNode != null)
                    selectedTreeNode.Expand();

                PopulateNodeTree();
                PopulateFormWithNode(destinationNode, true);
            }
        }