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


C# TreeView.selected方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeView.selected方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.selected方法的具体用法?C# TreeView.selected怎么用?C# TreeView.selected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeView的用法示例。


在下文中一共展示了TreeView.selected方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: showInTreeView

        public static void showInTreeView(this MethodMappings methodMappings, TreeView treeView, string filter, bool showSourceCodeSnippets, bool onlyShowSourceCodeLine)
        {
            treeView.parent().backColor("LightPink");
            treeView.visible(false);
            treeView.clear();
            var indexedMappings = methodMappings.indexedByKey(filter);
            if (onlyShowSourceCodeLine)
            {
                //do this so that we don't add more than one item per line
                var indexedByFileAndLine = new Dictionary<string, MethodMapping>();

                foreach(var item in indexedMappings)
                    foreach(var methodMapping in item.Value)
                        if (methodMapping.File.valid())
                        {
                            var key = "{0}_{1}".format(methodMapping.File, methodMapping.Start_Line);
                            indexedByFileAndLine.add(key, methodMapping);
                        }
                // now group then by the same text in the SourceCodeLine
                var indexedBySourceCodeLine =  new Dictionary<string, List<MethodMapping>>();
                foreach(var methodMapping in indexedByFileAndLine.Values)
                    indexedBySourceCodeLine.add(methodMapping.sourceCodeLine(), methodMapping);

                //Finally show then
                foreach(var item  in indexedBySourceCodeLine)
                {
                    var uniqueTextNode = treeView.add_Node(item.Key, item.Value,true);
                }
            }
            else
            {
                foreach(var item in indexedMappings)
                {
                    var keyNodeText = "{0}                       ({1})".format(item.Key, item.Value.size());
                    var keyNode= treeView.add_Node(keyNodeText, item.Value,true);
                }
                treeView.afterSelect<List<MethodMapping>>(
                    (mappings)=>{
                                    var keyNode = treeView.selected();
                                    keyNode.clear();
                                    foreach(var methodMapping in mappings)
                                    {
                                        var nodeText = (showSourceCodeSnippets)
                                            ? methodMapping.sourceCodeLine()
                                            : "{0} - {1}".format(methodMapping.INodeType,methodMapping.SourceCode);
                                        keyNode.add_Node(nodeText, methodMapping);
                                    }
                    });
            }
            treeView.parent().backColor("Control");
            treeView.visible(true);
        }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:52,代码来源:MethodMappings_ExtensionMethods_GUI.cs

示例2: loadFiles

		public void loadFiles(string filesPath, List<string> filesToLoad)
		{						
			sourceCode.set_Text("Loading files from: {0}".format(filesPath));
			Path.set_Text(filesPath);
			var filesContent = new Dictionary<string,string>();
			var nonBinaryFiles = new List<string>();
			foreach(var file in filesToLoad) 
				if (file.isBinaryFormat().isFalse()) 
					nonBinaryFiles.add(file);
			
			foreach(var file in nonBinaryFiles) 
					filesContent.add(file.remove(filesPath),file.contents());	
					
			searchEngine = new SearchEngine();
			searchEngine.loadFiles(nonBinaryFiles); 			
			
			//searchEngine.fixH2FileLoadingIssue();
			
			leftPanel.clear();
			treeView = leftPanel.add_TreeViewWithFilter(filesContent); 
			treeView.afterSelect<string>(
				(fileContents)=>{					
									sourceCode.open(filesPath + treeView.selected().get_Text());
								});						
			sourceCode.colorCodeForExtension(treeView.selected().str());
			sourceCode.set_Text("");
			textSearch_TextBox = leftPanel.controls<TextBox>(true)[1];
			textSearch_TextBox.onEnter(
				(text)=>{
					var searchResults = searchEngine.searchFor(text);
					dataGridView.loadInDataGridView_textSearchResults(searchResults);  
				});
			
			
		}		
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Scripts,代码行数:35,代码来源:ascx_SimpleFileSearch.cs

示例3: addStopInstanceGui

		public static API_AmazonEC2 addStopInstanceGui(this API_AmazonEC2 amazonEC2, Panel targetPanel, TreeView treeViewWithInstances)
		{						
			Action startTimer = null;
			Action stopTimer = null;
			var instancesToStop = targetPanel.add_GroupBox("Stop Instance in {0} minutes".format((amazonEC2.TimerCount * amazonEC2.TimerCount / 60))) 
									         .add_TreeView();						
			var timerBar = instancesToStop.insert_Below(20).add_ProgressBar();
			instancesToStop.add_ContextMenu().add_MenuItem("Stop now",true, 
													()=>{
															"Stopping {0} instances now".debug(instancesToStop.nodes().size()); 
															foreach(var node in instancesToStop.nodes())
																amazonEC2.stopInstance((RunningInstance)node.get_Tag());
														})
											 .add_MenuItem("Clear list", ()=>instancesToStop.clear());
			var startTimerLink = instancesToStop.insert_Above(15).add_Link("Add instance to list",0,0, 
													()=>{
															var selectedNode = treeViewWithInstances.selected();
															if (selectedNode.notNull())
															{
																var tag = selectedNode.get_Tag();  
																if (tag is RunningInstance)
																{
																	var selectedInstance = (RunningInstance)tag;
																	var nodeText = "{0} - {1}".format(selectedInstance.InstanceId, selectedInstance.IpAddress);
																	instancesToStop.add_Node(nodeText, selectedInstance);
																}
															}
															//treeViewWithInstances.nodes().showInfo();
														})
											.append_Link("Start timer", ()=>startTimer());  
			var timerEnabled = false;								
			var	stopTimerLink = startTimerLink.append_Link("Stop timer", ()=>stopTimer()).enabled(false);  							
			startTimer = ()=>{											
									"starting timer".info();
									timerEnabled = true;												
									timerBar.maximum(amazonEC2.TimerCount);
									timerBar.value(0);
									startTimerLink.enabled(false);
									stopTimerLink.enabled(true);
									while(timerEnabled && timerBar.Value < amazonEC2.TimerCount)
									{
										"In StopInstances Timer [{0}/{1}], sleeping for {2} seconds".info(timerBar.Value, amazonEC2.TimerCount, amazonEC2.TimerSleep/1000);
										timerBar.sleep(amazonEC2.TimerSleep, false);
										timerBar.increment(1);																										
									}
									if (timerEnabled)
									{													
										"Timer is completed stopping {0} instances now".debug(instancesToStop.nodes().size());
										foreach(var node in instancesToStop.nodes())
											amazonEC2.stopInstance((RunningInstance)node.get_Tag());
									}
									else
										"Timer was stopped so nothing to do".debug();			
									startTimerLink.enabled(true);
									stopTimerLink.enabled(false);

							 };
			stopTimer = ()=>{
								
									"stopping timer".info();
									timerEnabled = false; 
									
									startTimerLink.enabled(true);
									stopTimerLink.enabled(false);
							 };
			targetPanel.onClosed(()=> 	timerEnabled=false);					 
			
			return amazonEC2;
		}						
开发者ID:paul-green,项目名称:O2.Platform.Scripts,代码行数:69,代码来源:API_AmazonEC2.cs

示例4: addEditMenuItemsToTreeView

		public void addEditMenuItemsToTreeView(TreeView treeView)
        {
        	var contextMenu = treeView.add_ContextMenu(); 
			contextMenu.add_MenuItem("delete selected page (you must be an admin)",
							()=>{
									var pageToDelete = treeView.selected().get_Text();
									if (pageToDelete.valid()) 
										if (WikiApi.deletePage(pageToDelete)) 
											treeView.remove_Node(treeView.selected());													
								});	
								
		/*	contextMenu.add_MenuItem("reload all pages",
							()=>{
									treeView.clear();
									treeView.add_Nodes(WikiApi.allPages());
								}); 
		*/						
			var renameMenuItem = contextMenu.add_MenuItem("rename (user will copy, admin will move)");
			var renameTextBox = renameMenuItem.add_TextBox("rename");		   					   
			
			renameMenuItem.add_MenuItem("rename page with new title (set above)",
					()=> {
							var currentTitle = treeView.selected().get_Text();
							var newTitle = renameTextBox.get_Text(); 
							if (WikiApi.movePage(currentTitle, newTitle))
							{
								treeView.selected().set_Text(newTitle);								
							}
							//"renaming page '{0}' to '{1}'".info(currentTitle, newTitle);
						});
			treeView.afterSelect<string>(
					(page)=> 
							{								
								renameTextBox.set_Text(page);
								renameTextBox.width(page.size() * 7);								
							});						
        }
开发者ID:jobyjames85,项目名称:O2.Platform.Scripts,代码行数:37,代码来源:MediaWikiEditor.cs

示例5: buildGui

        public void buildGui()
        {
            try
            {
                var topPanel = this.add_Panel();
                //serializedString = topPanel.insert_Right(200).add_GroupBox("Serialized Object").add_SourceCodeViewer();
                //var serializedStringPanel = serializedString.splitContainer().panel2Collapsed(true);
                propertyGrid = topPanel.add_GroupBox("").add_PropertyGrid().helpVisible(false);
                treeView = propertyGrid.parent().insert_Left<Panel>().add_TreeView().sort();
                //treeView.splitterDistance(300);
                var toStringValue = propertyGrid.parent().insert_Below<Panel>(100).add_GroupBox("ToString Value (not editable):").add_TextArea();
                var optionsPanel = treeView.insert_Below<Panel>(70);
                var objectName = toStringValue.parent().insert_Above<Panel>(20).add_TextBox("name", "");
                //propertyGrid.onValueChange(updateSerializedString);

                //setSerializedStringSyncWithPropertyGrid();

                //serializedString.insert_Above(20).add_Link("Sync Serialized String With PropertyGrid", 0, 0, () => updateSerializedStringSyncWithPropertyGrid());

                LinkLabel invokeLink = null;
                invokeLink = optionsPanel.add_CheckBox("Show Methods", 0, 0,
                                (value) =>
                                {
                                    ShowMethods = value;
                                    invokeLink.enabled(value);
                                    refresh();
                                })
                                         .append_Link("invoke", invokeSelectedMethod)
                                            .leftAdd(-16).topAdd(5).bringToFront()
                                            .enabled(false);

                optionsPanel.add_CheckBox("Show Property and Field info", 22, 0,
                    (value) =>
                    {
                        ShowPropertyAndFieldInfo = value;
                        refresh();
                    })
                            .autoSize()
                            .append_Link("refresh", () => refresh())
                            .left(200);
                optionsPanel.add_CheckBox("Sort Values", 0, 135,
                    (value) =>
                    {
                        Sorted = value;
                        try
                        {
                            treeView.sort(Sorted);  // throwing "Unable to cast object of type 'System.Boolean' to type 'System.Windows.Forms.TreeView'"
                        }
                        catch//(Exception ex)
                        {
                            //ex.log();
                        }
                    })[email protected](true);

                simpleView_CheckBox = optionsPanel.add_CheckBox("Simple View", 0, 220,
                    (value) =>
                    {
                        SimpleView = value;
                        //propertyGrid.splitContainer().panel1Collapsed(value);
                        refresh();
                    })
                            .bringToFront();

                /*showSerializedString_CheckBox = optionsPanel.add_CheckBox("Show serialized string", 44, 0,
                    (value) =>
                    {
                        ShowSerializedString = value;
                        serializedStringPanel.panel2Collapsed(!value);
                        refresh();
                    })
                             .autoSize();*/

                createObjectWhenNull_CheckBox = optionsPanel.add_CheckBox("Create Object When Null", 44, 150,
                    (value) =>
                    {
                        CreateObjectWhenNull = value;
                    })
                            .bringToFront()
                            .autoSize();

                treeView.afterSelect<object>(
                    (selectedObject) =>
                    {
                        var treeNode = treeView.selected();
                        objectName.set_Text(treeNode.get_Text());
                        var tag = WinForms_ExtensionMethods_TreeView.get_Tag(treeNode);
                        if (tag.notNull())// && tag.str() != treeNode.get_Text())
                        {
                            propertyGrid.show(selectedObject);
                            var toString = selectedObject.str();
                            if (toString == "System.__ComObject")
                                toString += " : {0}".format(selectedObject.comObject_TypeName());
                            toStringValue.set_Text(toString);

                            propertyGrid.parent().set_Text(selectedObject.typeFullName());
                            if (treeNode.nodes().size() == 0)
                            {
                                addObjectPropertyAndFields(treeNode, selectedObject);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:njmube,项目名称:FluentSharp,代码行数:101,代码来源:ctrl_ObjectViewer.cs


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