本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetValue方法的具体用法?C# JObject.GetValue怎么用?C# JObject.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parseJObject
internal override void parseJObject(JObject obj)
{
base.parseJObject(obj);
ObjectType = extractString(obj.GetValue("ObjectType", StringComparison.InvariantCultureIgnoreCase));
foreach (IfcRelDefinesByProperties rdp in mDatabase.extractJArray<IfcRelDefinesByProperties>(obj.GetValue("IsDefinedBy", StringComparison.InvariantCultureIgnoreCase) as JArray))
rdp.Assign(this);
}
示例2: RatePlace
public Result<bool> RatePlace(JObject jsonData)
{
int placeId = jsonData.GetValue("placeId").ToObject<int>();
Rate[] rates = jsonData.GetValue("rates").ToObject<Rate[]>();
return this.GetResult(_rateService.RatePlace(this.GetAuthenticatedAccountId(), placeId, rates));
}
示例3: restore
public override void restore(JObject state)
{
base.restore(state);
income = (bool)state.GetValue(INCOME);
eventTimeGenerator = (AbstractProcess)AbstractStorable.newInstance((JObject)state.GetValue(PROCESS));
amountGenerator = (AbstractValue)AbstractStorable.newInstance((JObject)state.GetValue(AMOUNT));
}
示例4: RemoteState
public object RemoteState(JObject state)
{
var action = state.GetValue("action").Value<string>();
var storeId = state.GetValue("storeId").Value<string>();
var stateName = state.GetValue("stateName").Value<string>();
var data = state.GetValue("data").Value<JObject>();
switch (action)
{
case "getAll":
return DtStates.ContainsKey(storeId)
? new
{
defaultState = DtStates[storeId].Item1,
states = DtStates[storeId].Item2
}
: new object();
case "setDefault":
if (DtStates.ContainsKey(storeId))
DtStates[storeId] = new Tuple<string, Dictionary<string, object>>(stateName, DtStates[storeId].Item2);
break;
case "delete":
if (DtStates.ContainsKey(storeId) && DtStates[storeId].Item2.ContainsKey(stateName))
DtStates[storeId].Item2.Remove(stateName);
break;
case "save":
if (!DtStates.ContainsKey(storeId))
DtStates[storeId] = new Tuple<string, Dictionary<string, object>>(null, new Dictionary<string, object>());
DtStates[storeId].Item2[stateName] = data;
break;
}
File.WriteAllText(GetStateFilePath(), JsonConvert.SerializeObject(DtStates));
return null;
}
示例5: parseJObject
internal override void parseJObject(JObject obj)
{
base.parseJObject(obj);
JObject jobj = obj.GetValue("Points", StringComparison.InvariantCultureIgnoreCase) as JObject;
if (jobj != null)
Points = mDatabase.parseJObject<IfcCartesianPointList>(jobj);
JArray array = obj.GetValue("Segments", StringComparison.InvariantCultureIgnoreCase) as JArray;
if (array != null)
{
foreach (JToken tok in array)
{
JObject ob = tok as JObject;
if (ob != null)
{
JToken jtoken = ob.GetValue("IfcLineIndex", StringComparison.InvariantCultureIgnoreCase);
if (jtoken != null)
mSegments.Add(new IfcLineIndex(jtoken.Value<string>().Split(" ".ToCharArray()).ToList().ConvertAll(x => int.Parse(x))));
else
{
jtoken = ob.GetValue("IfcArcIndex", StringComparison.InvariantCultureIgnoreCase);
if (jtoken != null)
{
List<int> tokens = jtoken.Value<string>().Split(" ".ToCharArray()).ToList().ConvertAll(x => int.Parse(x));
mSegments.Add(new IfcArcIndex(tokens[0], tokens[1], tokens[2]));
}
}
}
}
}
JToken token = obj.GetValue("SelfIntersect", StringComparison.InvariantCultureIgnoreCase);
if (token != null)
Enum.TryParse<IfcLogicalEnum>(token.Value<string>(), true, out mSelfIntersect);
}
示例6: Post
public async Task<bool> Post(JObject data)
{
try
{
//TODO: Trzeba rozpoznawać użytkowników i wysyłać do właściwych urzadzeń
var currentUser = this.User as ServiceUser;
////
NotificationHubClient hub = NotificationHubClient
.CreateClientFromConnectionString("Endpoint=sb://karolzakpip.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=J2Rrw4Xt67NADIOprmmEiyPX89LCOrcP+8WkCBMsuXw=", "karolzakpip");
string wnsToast = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><toast><visual><binding template=\"ToastText01\"><text id=\"1\">{0}</text></binding></visual></toast>", data.GetValue("message").Value<string>());
WindowsPushMessage message = new WindowsPushMessage();
message.XmlPayload = wnsToast;
//var result = await Services.Push.SendAsync(message, currentUser.Id);
await hub.SendWindowsNativeNotificationAsync(wnsToast,currentUser.Id);
////
string text = data.GetValue("message").Value<string>();
string toast = PrepareToastPayload(text, text);
await hub.SendMpnsNativeNotificationAsync(toast, currentUser.Id);
return true;
}
catch
{
return false;
}
}
示例7: parseJObject
internal override void parseJObject(JObject obj)
{
base.parseJObject(obj);
JObject jobj = obj.GetValue("OuterBoundary", StringComparison.InvariantCultureIgnoreCase) as JObject;
if (jobj != null)
OuterBoundary = mDatabase.parseJObject<IfcCurve>(jobj);
InnerBoundaries = mDatabase.extractJArray<IfcCurve>(obj.GetValue("InnerBoundaries", StringComparison.InvariantCultureIgnoreCase) as JArray);
}
示例8: parseJObject
internal static IfcTranslationalStiffnessSelect parseJObject(JObject obj)
{
JObject jobj = obj.GetValue("IfcBoolean", StringComparison.InvariantCultureIgnoreCase) as JObject;
if (jobj != null)
return new IfcTranslationalStiffnessSelect( jobj.Value<bool>());
jobj = obj.GetValue("IfcLinearStiffnessMeasure", StringComparison.InvariantCultureIgnoreCase) as JObject;
return (jobj != null ? new IfcTranslationalStiffnessSelect(jobj.Value<double>()) : null);
}
示例9: parseJObject
internal override void parseJObject(JObject obj)
{
base.parseJObject(obj);
JToken token = obj.GetValue("MethodOfMeasurement", StringComparison.InvariantCultureIgnoreCase);
if (token != null)
MethodOfMeasurement = token.Value<string>();
Quantities = mDatabase.extractJArray<IfcPhysicalQuantity>(obj.GetValue("Quantities", StringComparison.InvariantCultureIgnoreCase) as JArray);
}
示例10: GetInstance
public static NewVersionEvent GetInstance(JObject data)
{
return new NewVersionEvent()
{
GameId = data.GetValue("game_id").Value<string>(),
ReleaseId = data.GetValue("release_id").Value<string>(),
Version = data.GetValue("version").Value<string>()
};
}
示例11: RPCResponse
public RPCResponse(JObject json)
{
var error = json.GetValue("error") as JObject;
if(error != null)
{
Error = new RPCError(error);
}
Result = json.GetValue("result") as JToken;
}
示例12: parseJObject
internal override void parseJObject(JObject obj)
{
base.parseJObject(obj);
JToken token = obj.GetValue("CountValue", StringComparison.InvariantCultureIgnoreCase);
if (token != null)
CountValue = token.Value<double>();
token = obj.GetValue("Formula", StringComparison.InvariantCultureIgnoreCase);
if (token != null)
Formula = token.Value<string>();
}
示例13: parseJObject
internal override void parseJObject(JObject obj)
{
base.parseJObject(obj);
JObject jobj = obj.GetValue("MappingSource", StringComparison.InvariantCultureIgnoreCase) as JObject;
if (jobj != null)
MappingSource = mDatabase.parseJObject<IfcRepresentationMap>(jobj);
jobj = obj.GetValue("MappingTarget", StringComparison.InvariantCultureIgnoreCase) as JObject;
if (jobj != null)
MappingTarget = mDatabase.parseJObject<IfcCartesianTransformationOperator3D>(jobj);
}
示例14: Post
public async Task Post(JObject data)
{
await PushNotificationsService.NotifyVehicleRequestedAsync
(
data.GetValue("employeeId").Value<string>(),
data.GetValue("driverId").Value<int>(),
data.GetValue("latitude").Value<double>(),
data.GetValue("longitude").Value<double>()
);
}
示例15: Post
public async Task Post(JObject data)
{
var message = new TemplatePushMessage()
{
{ "patientId", data.GetValue("patientId").Value<string>() },
{ "doctorId", data.GetValue("doctorId").Value<string>() },
{ "message", data.GetValue("message").Value<string>() }
};
await GetPushClient().SendTemplateNotificationAsync(message);
}