本文整理汇总了C#中System.Json.JsonObject.s方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.s方法的具体用法?C# JsonObject.s怎么用?C# JsonObject.s使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.s方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _parseElement
private void _parseElement(JsonObject json, Section section, JsonValue data){
string type = "Unknown";
try {
type = json["type"];
if (type=="HiddenElement"){
var name = json.s("id");
_controller.SetValue(name, data==null? json.s("value") : data.CleanString());
} else {
string id = (json.ContainsKey("id") ? json["id"] : null);
var newElement = _parseFunctions[type](json, _controller, data);
if (newElement!=null) {
newElement.ID = id;
_elements.Add(newElement);
section.Add(newElement);
}
}
} catch (Exception e){
Console.WriteLine("Problem parsing element. Element was skipped. Type: "+type+" = " + e.ToString());
}
}
示例2: _configureDialog
private void _configureDialog(JsonValue json, JsonObject valuesJson){
if (json.ContainsKey("grouped")) {
Style = bool.Parse(json["grouped"].ToString()) ? UITableViewStyle.Grouped : UITableViewStyle.Plain;
}
if (json.ContainsKey("title"))
Title = json["title"];
if (json.ContainsKey("dataroot"))
DataRootName = json["dataroot"];
if (json.ContainsKey("rightbaritem")){
var item = (JsonObject)json["rightbaritem"];
string datavalue = null, id = null;
id = item.s("id");
if (valuesJson!=null && !string.IsNullOrEmpty(id)){
datavalue = valuesJson.s(id);
}
if (item.ContainsKey("action")) {
rightBarItem = item.ContainsKey("url") ?
new SubmitElement(item.s("caption"), datavalue ?? item.s("url"), null, null) :
new ActionElement(item.s("caption"), datavalue ?? item.s("action"), null);
rightBarItem.ID = id;
}
if (item.ContainsKey("image")){
NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIImage.FromBundle(item.s("image")), UIBarButtonItemStyle.Plain, (object o, EventArgs a)=>{
InvokeAction(this.rightBarItem);
});
} else {
NavigationItem.RightBarButtonItem = new UIBarButtonItem(item.s("caption"), UIBarButtonItemStyle.Plain, (object o, EventArgs a)=>{
InvokeAction(this.rightBarItem);
});
}
}
if (json.ContainsKey("leftbaritem")){
var item = (JsonObject)json["leftbaritem"];
if (item.ContainsKey("action")) {
leftBarItem = item.ContainsKey("url") ?
new SubmitElement(item.s("caption"), item.s("url"), null, null) :
new ActionElement(item.s("caption"), item.s("action"), null);
leftBarItem.ID = item.s("id");
}
NavigationItem.LeftBarButtonItem = new UIBarButtonItem(item.s("caption"), UIBarButtonItemStyle.Plain, (object o, EventArgs a)=>{
InvokeAction(this.leftBarItem);
});
}
}