コード例 #1
0
        public void Init(TreeNode treeNode)
        {
            if (treeNode == null)
            {
                throw new ArgumentNullException("TreeNode");
            }

            TreeNode = treeNode;

            TreeNodeParent = treeNode.Parent;

            if (treeNode.Parent != null)
            {
                TreeNodePos = treeNode.Parent.Children.IndexOf(treeNode);
            }

            CollectManagedMediaTreeNodeVisitor collectorVisitor = new CollectManagedMediaTreeNodeVisitor();

            treeNode.AcceptDepthFirst(collectorVisitor);

            List <IManaged> list = collectorVisitor.CollectedMedia;

            foreach (IManaged mm in list)
            {
                if (mm.MediaData != null && !m_UsedMediaData.Contains(mm.MediaData))
                {
                    m_UsedMediaData.Add(mm.MediaData);
                }
            }

            ShortDescription = "Remove TreeNode";
            LongDescription  = "Remove the TreeNode";
        }
コード例 #2
0
        public void Init(TreeNode treeNode, TreeNode parent, int position)
        {
            if (treeNode == null)
            {
                throw new ArgumentNullException("TreeNode");
            }
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (position < 0 || position > parent.Children.Count)
            {
                throw new ArgumentOutOfRangeException("position");
            }

            TreeNode = treeNode;

            TreeNodeParent = parent;

            TreeNodePos = position;

            CollectManagedMediaTreeNodeVisitor collectorVisitor = new CollectManagedMediaTreeNodeVisitor();

            treeNode.AcceptDepthFirst(collectorVisitor);

            List <IManaged> list = collectorVisitor.CollectedMedia;

            foreach (IManaged mm in list)
            {
                if (mm.MediaData != null && !m_UsedMediaData.Contains(mm.MediaData))
                {
                    m_UsedMediaData.Add(mm.MediaData);
                }
            }

            ShortDescription = "Insert TreeNode";
            LongDescription  = "Insert the TreeNode";
        }