Example #1
0
        /// <summary>
        /// 初始化树数据
        /// </summary>
        public void LoadTreeData()
        {
            this.BeginUpdate();

            this.Nodes.Clear();
            TmpltFolderXmlElement sdsiteDoc = Service.Sdsite.CurrentDocument.TmpltFolder;

            foreach (var node in sdsiteDoc.ChildNodes)
            {
                if (node is FolderXmlElement)
                {
                    FolderElementNode FolderNode = new FolderElementNode(node as FolderXmlElement);
                    SetElementNode(FolderNode);
                    AddTmpltFolder(node as FolderXmlElement);
                }
                else if (node is TmpltSimpleExXmlElement)
                {
                    TmpltElementNode tmpltNode = new TmpltElementNode(node as TmpltSimpleExXmlElement);

                    if ((TmpltFilter == TmpltTreeNodeType.none) || TmpltFilter == tmpltNode.CurrentNodeType)
                    {
                        SetElementNode(tmpltNode);
                        AddRootNodeToTree(tmpltNode);
                    }
                }
            }
            this.EndUpdate();
            this.ContextMenuStrip = TmpltTreeContextMenuStrip.CreateForTreeView(this);
        }
Example #2
0
        static public TmpltTreeContextMenuStrip CreateForTreeView(TmpltTreeView treeView)
        {
            ///创建一个TreeContextMenuStrip
            TmpltTreeContextMenuStrip menuStrip = new TmpltTreeContextMenuStrip();

            menuStrip.Items.AddRange(new ToolStripItem[] {
                new TmpltOpenMenuItem(treeView),
                new ToolStripSeparator(),
                new TmpltCutMenuItem(treeView),
                new TmpltCopyMenuItem(treeView),
                new TmpltPasteMenuItem(treeView),
                new TmpltDeleteMenuItem(treeView),
                new TmpltRenameMenuItem(treeView),
                new ToolStripSeparator(),
                new TmpltGotoCss(treeView),
                new ToolStripSeparator()
            });
            return(menuStrip);
        }