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


C# Action.notNull方法代码示例

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


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

示例1: add_MenuItem

 public static MenuItem add_MenuItem(this MenuItem menuItem , string name, bool returnNewMenuItem, Action onClick)
 {
     return (MenuItem)menuItem.parentForm()
                              .invokeOnThread(
                                  ()=>{
                                          var newMenuItem = new MenuItem();
                                          newMenuItem.Text = name;
                                          if(onClick.notNull())
                                              newMenuItem.Click+= (sender,e)=>{
                                                                                  O2Thread.mtaThread(()=> onClick());
                                              };
                                          menuItem.MenuItems.Add(newMenuItem);
                                          if (returnNewMenuItem)
                                              return newMenuItem;
                                          return menuItem;
                                  });
 }
开发者ID:njmube,项目名称:FluentSharp,代码行数:17,代码来源:WinForms_ExtensionMethods_MainMenu.cs

示例2: add_TreeView_For_CommandClasses_Visualization

		public static TreeView add_TreeView_For_CommandClasses_Visualization(this Control control, JavaMetadata_XRefs xRefs, Action<string> onClassSelected, Func<string,string,string> resolveGetterReturnType	)
		{
			var treeView = control.add_TreeView();   

			var showHttpName = false; 
			var configPanel = control.insert_Below(30);
			configPanel.add_CheckBox("Show Http Variable Name",0,0,(value)=> showHttpName = value)
					   .autoSize(); 
			
			Func<Java_Method,string> getMethodNodeText =
				(method) => {
								if (showHttpName)
									return method.Name
												 .subString(3)
												 .lowerCaseFirstLetter();
									
								return "{0}   {1}".format(method.Name, method.returnType());
								//.GenericSignature.isNull()
								//											? method.ParametersAndReturnType
								//											: method.GenericSignature.returnType());
							};
			Func<string,string,string> localResolveGetterReturnType =
				(methodName, returnType) => {
												if (resolveGetterReturnType.isNull())
													return returnType;
												return resolveGetterReturnType(methodName, returnType);									
											};
			
			Action<TreeNode, string> add_Getters =  
				(treeNode, className)=> {
											if (xRefs.Classes_by_Signature.hasKey(className))
											{									
												var _class = xRefs.Classes_by_Signature[className];  
												var getters = _class.java_Methods_Getters_Public().with_Primitive_ReturnType(false); 
												
												treeNode.add_Nodes( getters.Where((method)=>method.returnType()!="java.lang.String"),   
																	(method)=> getMethodNodeText(method),
																	//(method)=> method.str(),
								 									(method)=> localResolveGetterReturnType(method.Name,method.returnType()), 
																	(method)=> true, 
																	(method)=> Color.DarkBlue);
			
											}
											else											
												treeNode.add_Node("[Getters] ... class not found: {0}".format(className))
														.color(Color.DarkRed);
										}; 
			  
			Action<TreeNode, string> add_Setters =  
				(treeNode, className)=> { 
											if (xRefs.Classes_by_Signature.hasKey(className))
											{									 
												var _class = xRefs.Classes_by_Signature[className];     
												var setters = _class.java_Methods_Setters_Public().with_Primitive_Parameter(true);  
												
												treeNode.add_Nodes( setters, 
																	//(method)=> "{0}   {1}".format(method.Name, method.ParametersAndReturnType), 
																	(method)=> getMethodNodeText(method),
																	(method)=> method ,
																	(method)=> false,
																	(method)=> Color.DarkGreen);
			
											}
											else
												treeNode.add_Node("[Setters] ... class not found: {0}".format(className))
														.color(Color.DarkRed);
										};
										
			
			treeView.beforeExpand<string>(
				(treeNode, returnType)=>{	
											var className = (returnType.starts("L"))
																? returnType.removeFirstChar().removeLastChar()
																: returnType;
											add_Getters(treeNode, className);
											add_Setters(treeNode, className);								
											//if (xRefs.Classes_by_Signature.hasKey(className))
											//	treeNode.add_Node("FOUND Class!!!");
											//else
											//	treeNode.add_Node(returnType);					
							  			});
			
			treeView.afterSelect<string>(
				(@class)=>{
							if (onClassSelected.notNull())
								onClassSelected(@class);
						  });
						  
			return treeView;							  			
		}
开发者ID:pusp,项目名称:o2platform,代码行数:90,代码来源:SpringMvcMappings_v2.0.cs

示例3: add_TreeView_for_HtmlTags

    	public static TreeView add_TreeView_for_HtmlTags(this Control control, Action<string> applyFilter)
    	{
    		control.clear();
    		var htmlTags_TreeView = control.add_TreeView();
    		htmlTags_TreeView.beforeExpand<HtmlAgilityPack.HtmlNode>(
					(treeNode, htmlNode)=>{																
											  if (htmlNode.Attributes != null)
											  	  foreach(var attribute in htmlNode.Attributes)
											 	  	  treeNode.add_Node("a: {0}={1}".format(attribute.Name, attribute.Value)); 
											  treeNode.add_Node("v: {0}".format(htmlNode.InnerHtml));  	
											  if (htmlNode.ChildNodes != null)
											  	  foreach(var childNode in htmlNode.ChildNodes)
												  	  if (childNode.html().valid()) 
													  	  treeNode.add_Node("n: {0}".format(childNode.Name), childNode, true);  
										  });	
										  
			var treeView_ContextMenu = htmlTags_TreeView.add_ContextMenu();			
			treeView_ContextMenu.add_MenuItem("Sort Nodes", ()=> htmlTags_TreeView.sort());
			treeView_ContextMenu.add_MenuItem("Don't Sort Nodes", ()=> htmlTags_TreeView.sort(false));
			//treeView_ContextMenu.add_MenuItem("Show all nodes",()=> htmlNodeFilter.sendKeys("//*".line()));   
			
			if (applyFilter.notNull())
				htmlTags_TreeView.insert_Below_HtmlTagFilter(applyFilter);
			return htmlTags_TreeView;										  
    	}
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Scripts,代码行数:25,代码来源:HtmlAgilityPack_ExtensionMethods.cs

示例4: onProcessChange

		public Ctrl_ProcessFinder onProcessChange(Action<Process> callback)
		{
			if(callback.notNull())
				this.ActiveWindowChanged  += (sender, e)=> callback.invoke(this.TargetProcess);	
			return this;
		}
开发者ID:paul-green,项目名称:O2.Platform.Scripts,代码行数:6,代码来源:Ctrl_ProcessFinder.cs

示例5: Command

 public Command(Action<object> execute, Predicate<object> canExecute)
 {
     this.execute = execute.notNull();
     this.canExecute = canExecute;
 }
开发者ID:bjornebjornson,项目名称:LottoEf4,代码行数:5,代码来源:Command.cs


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