• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TreeItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TreeItem的典型用法代码示例。如果您正苦于以下问题:C# TreeItem类的具体用法?C# TreeItem怎么用?C# TreeItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TreeItem类属于命名空间,在下文中一共展示了TreeItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TreePrint

 public void TreePrint(TreeItem treeItem)
 {
     foreach (var item in treeItem.SubItems.OrderBy(x => x.Order))
     {
         ChildPrint(item, 0);
     }
 }
开发者ID:abeloborodov,项目名称:hierarchy-data,代码行数:7,代码来源:ParentChildApi.cs


示例2: PopulateFolders

        private static void PopulateFolders(string dirName, TreeItem<string> parentFolder)
        {
            string[] folderItems = Directory.GetFileSystemEntries(dirName);

            foreach (var folderItem in folderItems)
            {
                TreeItem<string> folderSubItem = new TreeItem<string>(folderItem);
                parentFolder.AddChild(folderSubItem);

                // If the current node is a filename, don't call recursion and continue
                try
                {
                    Directory.GetDirectories(folderItem);
                }
                catch (IOException ex)
                {
                    continue;
                }
                catch (UnauthorizedAccessException)
                {
                    Console.WriteLine("LOG: No access to folder {0}", dirName);
                    continue;
                }

                PopulateFolders(folderItem, folderSubItem);
            }
        }
开发者ID:kikooo52,项目名称:taCSharp,代码行数:27,代码来源:WindowsFolder.cs


示例3: GenerateTteeVm

 public TreeItem GenerateTteeVm(int col, int depth, string version)
 {
     OrderInc = 0;
     var item = new TreeItem() { Name = "root " + version };
     item.SubItems = GenerateTteeItemList(col, depth,version);
     return item;
 }
开发者ID:abeloborodov,项目名称:hierarchy-data,代码行数:7,代码来源:ParentChildApi.cs


示例4: GenerateTree

 private void GenerateTree(TreeItem<FileSystemItem> node, int depth, int level = 0)
 {
     var itemCount = C.Random<int>(_fakingRules.GetItemCount(level));
     var nodes = node.AddRange(C.CollectionOfFake<FileSystemItem>(itemCount, new { Type = _fakingRules.GetItemTypes(level), Name = new Range(8,13) }));
     foreach (var n in nodes)
     {
         n.Content.FullPath = n.Content.Path = node.Content.Path + "/" + n.Content.Name;
         n.Content.Size = C.Random<int>(0xFF, 0xFFFF);
         if (level < depth) GenerateTree(n, depth, level+1);
     }
 }
开发者ID:mousetwentytwo,项目名称:test,代码行数:11,代码来源:DummyContent.cs


示例5: TreeItem

		public TreeItem (TreeStore store, TreeItem parent, CoverageItem model, string title) {
			this.store = store;
			this.parent = parent;
			this.model = model;

			if (parent == null)
				iter = store.AppendValues (title);
			else
				iter = store.AppendValues (parent.Iter, title);
			FillColumns ();
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:11,代码来源:CoverageView.cs


示例6: TreeEntryMenu

        public TreeEntryMenu(ITreeSource treeSource, TreeItem treeItem)
        {
            if(treeSource == null) throw new ArgumentNullException("treeSource");
            if(treeItem == null) throw new ArgumentNullException("treeItem");

            _treeSource = treeSource;
            _treeItem = treeItem;

            // save as
            // checkout

            Items.Add(GuiItemFactory.GetCheckoutPathItem<ToolStripMenuItem>(treeSource, treeItem.RelativePath));
        }
开发者ID:Kuzq,项目名称:gitter,代码行数:13,代码来源:TreeEntryMenu.cs


示例7: WriteTree

 public void WriteTree(Guid versionId, TreeItem item)
 {
     OrderInc = 0;
     //            using (var context = _context)
     {
         //foreach (var element in item.SubItems.OrderBy(x => x.Order))
         {
             var root = Dive(item, null, versionId);
             HierarchyParentChildContext.Elements.Add(root);
             HierarchyParentChildContext.SaveChanges();
         }
     }
 }
开发者ID:abeloborodov,项目名称:hierarchy-data,代码行数:13,代码来源:ParentChildApi.cs


示例8: CreateTreeItem

 TreeItem CreateTreeItem(int level, string name, Image image)
 {
     var item = new TreeItem {
         Text = name,
         Expanded = expanded++ % 2 == 0,
         Image = image
     };
     if (level < 4) {
         for (int i = 0; i < 4; i++) {
             item.Children.Add (CreateTreeItem (level + 1, name + " " + i, image));
         }
     }
     return item;
 }
开发者ID:M1C,项目名称:Eto,代码行数:14,代码来源:TreeViewSection.cs


示例9: UnstagedItemMenu

        public UnstagedItemMenu(TreeItem item)
        {
            Verify.Argument.IsValidGitObject(item, "item");
            Verify.Argument.AreEqual(StagedStatus.Unstaged, item.StagedStatus & StagedStatus.Unstaged, "item",
                "This item is not unstaged.");

            _item = item;

            var dir = _item as TreeDirectory;
            if(_item.Status != FileStatus.Removed)
            {
                var fullPath = _item.FullPath;
                if(dir == null)
                {
                    Items.Add(GuiItemFactory.GetOpenUrlItem<ToolStripMenuItem>(Resources.StrOpen, null, fullPath));
                    Items.Add(GuiItemFactory.GetOpenUrlWithItem<ToolStripMenuItem>(Resources.StrOpenWith.AddEllipsis(), null, fullPath));
                    Items.Add(GuiItemFactory.GetOpenUrlItem<ToolStripMenuItem>(Resources.StrOpenContainingFolder, null, Path.GetDirectoryName(fullPath)));
                }
                else
                {
                    Items.Add(GuiItemFactory.GetOpenUrlItem<ToolStripMenuItem>(Resources.StrOpenInWindowsExplorer, null, fullPath));
                }
                Items.Add(new ToolStripSeparator());
            }
            Items.Add(GuiItemFactory.GetStageItem<ToolStripMenuItem>(_item));
            if(dir != null)
            {
                if(HasRevertableItems(dir))
                {
                    Items.Add(GuiItemFactory.GetRevertPathItem<ToolStripMenuItem>(_item));
                }
            }
            else
            {
                if(_item.Status == FileStatus.Removed || _item.Status == FileStatus.Modified)
                {
                    Items.Add(GuiItemFactory.GetRevertPathItem<ToolStripMenuItem>(_item));
                }
                if(_item.Status == FileStatus.Modified || _item.Status == FileStatus.Added)
                {
                    Items.Add(GuiItemFactory.GetRemovePathItem<ToolStripMenuItem>(_item));
                }
            }
        }
开发者ID:Kuzq,项目名称:gitter,代码行数:44,代码来源:UnstagedItemMenu.cs


示例10: FindExeFile

        private static void FindExeFile(List<string> foundExeFiles, TreeItem<string> treeItem)
        {
            string pattern = "exe";

            if (!treeItem.IsFolder)
            {
                string[] fileParts = treeItem.Value.Split('.');

                if (fileParts[fileParts.Length - 1] == pattern)
                {
                    foundExeFiles.Add(treeItem.Value);
                }
            }

            for (int i = 0; i < treeItem.ChildItemsCount; i++)
            {
                FindExeFile(foundExeFiles, treeItem.GetChild(i));
            }
        }
开发者ID:kikooo52,项目名称:taCSharp,代码行数:19,代码来源:WindowsFolder.cs


示例11: Index_GET

        public void Index_GET()
        {
            IList<SiteDto> sites=SiteCacheManager.GetAllSites();
            TreeItem[] items=new TreeItem[sites.Count];
            for (int i = 0; i < sites.Count; i++)
            {
                items[i] = new TreeItem
                {
                    ID=sites[i].SiteId,
                    Name=sites[i].Name + (sites[i].Note.Trim()!=""?"["+sites[i].Note+"]":"")
                };
            }


            base.RenderTemplate(ResourceMap.GetPageContent(ManagementPage.Site_Index), new
            {
                siteTree=Helper.SingleTree("所有站点",items)
            });
        }
开发者ID:coodream,项目名称:cms,代码行数:19,代码来源:SiteC.cs


示例12: UserList

		public UserList (Channel channel)
		{
			this.Channel = channel;
			tree = new TreeView ();
			tree.Style = "userList";
			tree.Activated += HandleActivated;
			
			items = new TreeItemCollection ();
			items.Add (owners = new TreeItem { Text = "Room Owners", Expanded = true });
			items.Add (online = new TreeItem { Text = "Online", Expanded = true });
			items.Add (away = new TreeItem { Text = "Away", Expanded = true });
			if (Generator.ID == Generators.Mac) {
				foreach (var item in items.OfType<TreeItem>()) {
					item.Text = item.Text.ToUpperInvariant();
				}
			}
			tree.DataStore = items;
			
			this.AddDockedControl (tree);
		}
开发者ID:neiz,项目名称:JabbR.Eto,代码行数:20,代码来源:UserList.cs


示例13: Main

        static void Main(string[] args)
        {
            string rootDirectory = @"C:\Windows";

            TreeItem<string> rootFolder = new TreeItem<string>(rootDirectory);

            Console.WriteLine("Getting items in {0}, this can take a while", rootDirectory);
            Console.WriteLine();

            PopulateFolders(rootDirectory, rootFolder);

            Tree<string> foldersTree = new Tree<string>(rootFolder);

            List<string> exeFiles = new List<string>();

            FindExeFile(exeFiles, foldersTree.Root);

            Console.WriteLine();
            Console.WriteLine("Found {0} .exe files", exeFiles.Count);
        }
开发者ID:kikooo52,项目名称:taCSharp,代码行数:20,代码来源:WindowsFolder.cs


示例14: ExpandToSelection

      /// <summary>
      /// Expands the root tree item to the currently selected item.
      /// </summary>
      /// <param name="iRoot">Root tree item.</param>
      private void ExpandToSelection(ref TreeItem iRoot)
      {
         if (iRoot == null || SelectedId == 0 || SelectedId == iRoot.Id)
            return;

         var treeItem = LoadTreeItem(SelectedId);

         var records = EmployeeModel.AllRecords;
         var record = records.FirstOrDefault(i => i.Id == SelectedId);
         var reportToId = record.ReportTo;

         // Start from the selected item and work our way up until the root is reached.
         while (reportToId != iRoot.Id && (record = records.FirstOrDefault(i => i.Id == reportToId)) != null)
         {
            var parentItem = LoadTreeItem(record.Id);
            parentItem.Children[parentItem.Children.FindIndex(i => i.Id == treeItem.Id)] = treeItem;
            reportToId = record.ReportTo;
            treeItem = parentItem;
         }
         iRoot.Children[iRoot.Children.FindIndex(i => i.Id == treeItem.Id)] = treeItem;
      }
开发者ID:dadhi,项目名称:dotNetify,代码行数:25,代码来源:TreeViewVM.cs


示例15: CompareTrees

 private static Result CompareTrees(TreeItem tree1, TreeItem tree2)
 {
     if (tree1.Name != tree2.Name) return new Result(false, tree1, tree2);
     if (tree1.Order != tree2.Order) return new Result(false, tree1, tree2);
     if (tree1.SubItems == null)
     {
         if (tree2.SubItems != null) return new Result(false, tree1, tree2);
         if (tree1.Placeholder != tree2.Placeholder) return new Result(false, tree1, tree2);
     }
     else
     {
         if (tree2.SubItems == null) return new Result(false, tree1, tree2);
         if (tree1.SubItems.Count != tree2.SubItems.Count) return new Result(false, tree1, tree2);
         for (int i = 0; i < tree1.SubItems.Count; i++)
         {
             var r = CompareTrees(tree1.SubItems[i], tree2.SubItems[i]);
             if (!r.Equals) return r;
         }
     }
     return new Result(true, null, null);
 }
开发者ID:abeloborodov,项目名称:hierarchy-data,代码行数:21,代码来源:Program.cs


示例16: GenerateCustomDataTree

        public void GenerateCustomDataTree(out TreeItem input, out TreeItem output)
        {
            input = new TreeItem() { Name = "InputData", IsChoice = false, SubItems = new List<TreeItem>() };
            output = new TreeItem() { Name = "OutputData", IsChoice = false, SubItems = new List<TreeItem>() };

            input.SubItems.Add(new TreeItem() { Name = "Корневой", Placeholder = "я корневой", Order = 0 });
            TreeItem inputRoot = new TreeItem()
            {
                Name = "Справка",
                SubItems = new List<TreeItem>()
                {
                    new TreeItem()
                    {
                        Name = "Паспорт",
                        Order = 0,
                        SubItems =
                            new List<TreeItem>()
                            {
                                new TreeItem() {Name = "Серия", Placeholder = "8003", Order = 0},
                                new TreeItem() {Name = "номер", Placeholder = "600000", Order = 1}
                            }
                    },
                    new TreeItem()
                    {
                        Name = "ФИО",
                        Order = 1,
                        SubItems =
                            new List<TreeItem>()
                            {
                                new TreeItem() {Name = "Имя", Placeholder = "Петя", Order = 0},
                                new TreeItem() {Name = "Фамилия", Placeholder = "Кошечкин", Order = 1}
                            }
                    },
                    new TreeItem() {Name = "Номер справки", Placeholder = "СПР-1", Order = 2}
                },
                Order = 1
            };
            input.SubItems.Add(inputRoot);
            output.SubItems.Add(new TreeItem() { Name = "Корневой Вых", Placeholder = "я корневой вых", Order = 0 });
        }
开发者ID:abeloborodov,项目名称:hierarchy-data,代码行数:40,代码来源:HierarchyIdApi.cs


示例17: BuildTree

        private List<TreeItem<FileLayerSongDO>> BuildTree(IEnumerable<Tuple<int, List<string>>> data, int depth)
        {
            // wenn depth == items2.length
            // break;

            var grped = from r in
                            (from item in data
                             where item.Item2.Count > depth
                             select item)
                        group r by r.Item2[depth] into grp
                        select grp;

            List<TreeItem<FileLayerSongDO>> result = null;
            if (grped.Any())
            {
                result = new List<TreeItem<FileLayerSongDO>>();

                foreach (var item in grped)
                {
                    var child = new TreeItem<FileLayerSongDO>();
                    child.Level = depth;
                    var temp = new FileLayerSongDO();
                    temp.SetByDepth(depth, item.Key);
                    var current = item.First();

                    if (depth == current.Item2.Count - 1)
                        temp.ID = item.First().Item1;

                    child.Value = temp;

                    var childs = BuildTree(item, depth + 1);
                    if (childs != null)
                        child.SetChildren(childs);

                    result.Add(child);
                }
            }
            return result;
        }
开发者ID:Epibatidin,项目名称:FLUX,代码行数:39,代码来源:TreeBuilder.cs


示例18: TestDataContractJsonSerializer

        public void TestDataContractJsonSerializer()
        {
            var treeitem = new TreeItem<string>();
            treeitem.Id = "1";
            treeitem.Text = "Root";
            treeitem.Value = "3223";
            treeitem.Isexpand = true;
            treeitem.Showcheck = true;
            treeitem.Add(
                new TreeItem<string>
                    {
                       Id = "2", Text = "Node2", Value = "9982", Showcheck = true, Isexpand = true, Checkstate = 1 
                    });

            string mstr = treeitem.ToJsonString2();

            Console.WriteLine(mstr);

            string tstr = treeitem.ToJsonString();
            Console.WriteLine(tstr);

            Assert.Equal(tstr.Length, mstr.Length);
        }
开发者ID:kouweizhong,项目名称:ironframework,代码行数:23,代码来源:TestTreeItem.cs


示例19: ChildPrint

        private void ChildPrint(TreeItem element, int i)
        {
            var ii = i;
            var tab = "";
            for (int j = 0; j < i; j++)
            {
                tab = tab + "_";
            }

            if (element.SubItems == null)
            {
                Console.WriteLine(tab + element.Name + " " + element.Placeholder);
            }
            else
            {
                Console.WriteLine(tab + element.Name);
                ++ii;
                foreach (var child in element.SubItems.OrderBy(x => x.Order))
                {
                    ChildPrint(child, ii);
                }
            }
        }
开发者ID:abeloborodov,项目名称:hierarchy-data,代码行数:23,代码来源:ParentChildApi.cs


示例20: Proccess

        public bool Proccess(string atom, AbstractTreeItem seed, out AbstractTreeItem item)
        {
            MathExpr[] exprs = null;
            item= new TreeItem();
            item.Type=TreeItemType.Выражение;
            string polska = null;
            try
            {
                polska = GetPolskaFormat(atom, out exprs);
            }
            catch (MpException e)
            {
                item.Error = true;
                item.ErrorCode = e.Code;
            }
            catch (Exception e)
            {
                item.Error = true;
                item.ErrorCode = ErrorCodes.Unknown;
            }
            throw new NotImplementedException();

        }
开发者ID:yamaoto,项目名称:math-proc,代码行数:23,代码来源:ProccessВыражение.cs



注:本文中的TreeItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TreeList类代码示例发布时间:2022-05-24
下一篇:
C# TreeGridNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap