当前位置: 首页>>代码示例>>C#>>正文


C# TreeItem类代码示例

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


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


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