本文整理汇总了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;
});
}
示例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;
}
示例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;
}
示例4: onProcessChange
public Ctrl_ProcessFinder onProcessChange(Action<Process> callback)
{
if(callback.notNull())
this.ActiveWindowChanged += (sender, e)=> callback.invoke(this.TargetProcess);
return this;
}
示例5: Command
public Command(Action<object> execute, Predicate<object> canExecute)
{
this.execute = execute.notNull();
this.canExecute = canExecute;
}