本文整理汇总了C#中JsonValue.Get方法的典型用法代码示例。如果您正苦于以下问题:C# JsonValue.Get方法的具体用法?C# JsonValue.Get怎么用?C# JsonValue.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonValue
的用法示例。
在下文中一共展示了JsonValue.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Receive
public bool Receive(JsonValue aMessage)
{
if (!aMessage.IsObject) return false;
var type = aMessage.Get("type");
if (!type.IsString || type.AsString() != "xf-event") return false;
var ev = aMessage.Get("event");
if (!ev.IsString) return false;
EventHandler handler;
if (!iEventHandlers.TryGetValue(ev.AsString(), out handler)) return false;
handler(this, EventArgs.Empty);
return true;
}
示例2: Receive
public void Receive(JsonValue aJsonValue)
{
if (aJsonValue.IsObject)
{
JsonValue type = aJsonValue.Get("type");
if (!type.IsString)
{
Console.WriteLine("Bad message from client: {0}", aJsonValue);
return;
}
switch (type.AsString())
{
case "user":
string userid = aJsonValue.Get("id").AsString();
iBrowserTabProxy.SwitchUser(userid);
break;
}
}
}
示例3: Receive
public void Receive(JsonValue aJsonValue)
{
if (aJsonValue.IsObject)
{
JsonValue aType = aJsonValue.Get("type");
if (!aType.IsString)
{
Console.WriteLine("Bad message from client: {0}", aJsonValue);
return;
}
string userid;
switch (aType.AsString())
{
case "message":
lock (iLock)
{
userid = iUserId;
}
iChatApp.NewMessage(userid, aJsonValue.Get("content").AsString());
break;
case "changeuser":
iBrowserTabProxy.SwitchUser(null);
break;
case "user":
userid = aJsonValue.Get("id").AsString();
Console.WriteLine("SHOULD NOT GET HERE.");
iBrowserTabProxy.SetCookie("xappuser", userid, null);
iBrowserTabProxy.ReloadPage();
iBrowserTabProxy.SwitchUser(userid);
/*
User user;
if (!iUserList.TryGetUserById(userid, out user))
{
Console.WriteLine("Bad user id from client: {0}", userid);
}*/
//ChangeUser(userid);
break;
}
} else if (aJsonValue.IsString)
{
// Legacy.
iChatApp.NewMessage(iUserId, aJsonValue.AsString());
}
}
示例4: Receive
public void Receive(JsonValue aJsonValue)
{
if (aJsonValue.IsObject)
{
JsonValue aType = aJsonValue.Get("type");
if (!aType.IsString)
{
Console.WriteLine("Bad message from client: {0}", aJsonValue);
return;
}
string userid;
switch (aType.AsString())
{
case "message":
lock (iLock)
{
userid = iUserId;
}
iTestApp.NewMessage(userid, aJsonValue.Get("content").AsString());
break;
}
} else if (aJsonValue.IsString)
{
// Legacy.
iTestApp.NewMessage(iUserId, aJsonValue.AsString());
}
}