本文整理汇总了C#中JsonObject.GetNamedBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.GetNamedBoolean方法的具体用法?C# JsonObject.GetNamedBoolean怎么用?C# JsonObject.GetNamedBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject.GetNamedBoolean方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SlackChannel
public SlackChannel(JsonObject source)
{
Id = source.GetNamedString("id");
Name = source.GetNamedString("name");
var timestampCreation = (int)source.GetNamedNumber("created");
var offset = DateTimeOffset.FromUnixTimeSeconds(timestampCreation);
Created = offset.DateTime;
IsArchived = source.GetNamedBoolean("is_archived", false);
IsMember = source.GetNamedBoolean("is_member");
MembersCount = (int)source.GetNamedNumber("num_members");
var topicObject = source.GetNamedObject("topic");
Topic = topicObject.GetNamedString("value");
var purposeObject = source.GetNamedObject("purpose");
Purpose = purposeObject.GetNamedString("value");
}
示例2: OptionalBoolean
/// <summary>
///
/// </summary>
/// <param name="jsonObject"></param>
/// <param name="name"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static bool OptionalBoolean(JsonObject jsonObject, string name, bool defaultValue)
{
//System.Diagnostics.Debug.WriteLine("JsonHelper.OptionalBoolean(): " + name);
bool val = defaultValue;
try
{
if (jsonObject.ContainsKey(name))
{
val = jsonObject.GetNamedBoolean(name);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("JsonHelper.OptionalBoolean(): " + e.Message);
}
return val;
}
示例3: ApiPost
private void ApiPost(IOBoardController ioBoard, JsonObject value)
{
JsonArray state = value.GetNamedArray("state", null);
if (state != null)
{
byte[] buffer = JSONValueToByteArray(state);
ioBoard.SetState(buffer);
}
var commit = value.GetNamedBoolean("commit", true);
if (commit)
{
ioBoard.CommitChanges();
}
}
示例4: ApplyJSONPortState
private void ApplyJSONPortState(IOBoardController ioBoard, JsonObject value)
{
int port = (int) value.GetNamedNumber("port", 0);
bool state = value.GetNamedBoolean("state", false);
bool commit = value.GetNamedBoolean("commit", true);
ioBoard.SetPortState(port, state ? BinaryState.High : BinaryState.Low);
if (commit)
{
ioBoard.CommitChanges();
}
}
示例5: AssignMarks
private static void AssignMarks(LtpCourse course, JsonObject marksObject)
{
if (marksObject.GetNamedBoolean("supported") == false)
{
course.InternalMarksScored = 0;
course.TotalMarksTested = 0;
return;
}
double marksScored = 0;
JsonArray marksArray = marksObject.GetNamedArray("assessments");
foreach (JsonValue marksValue in marksArray)
{
JsonObject markStubObject = marksValue.GetObject();
string title = markStubObject.GetNamedString("title").ToUpper();
int maxMarks = (int)markStubObject.GetNamedNumber("max_marks");
int weightage = (int)markStubObject.GetNamedNumber("weightage");
MarkInfo markInfo;
if (markStubObject.GetNamedValue("scored_marks").ValueType == JsonValueType.Null)
markInfo = new MarkInfo(course, title, maxMarks, weightage, null, null, "");
else
{
markInfo = new MarkInfo(course, title, maxMarks, weightage,
null, // currently, 'conducted date' is being skipped.
markStubObject.GetNamedNumber("scored_marks"),
markStubObject.GetNamedString("status").ToUpper());
marksScored += (double)markInfo.WeightedMarks;
course.TotalMarksTested += markInfo.Weightage;
}
course.AddMarkInfo(markInfo);
}
course.InternalMarksScored = Math.Round(marksScored, 2);
}
示例6: AssignAttendance
private static void AssignAttendance(LtpCourse course, JsonObject attendanceObject)
{
int classLength = 1;
if (course as LBCCourse != null)
{
classLength = (int)Char.GetNumericValue(course.Ltpjc[2]);
}
if (attendanceObject.GetNamedBoolean("supported") == false)
{
course.Attendance = new Attendance(course, 0, 0, 0, classLength);
return;
}
ushort total = (ushort)attendanceObject.GetNamedNumber("total_classes");
ushort attended = (ushort)attendanceObject.GetNamedNumber("attended_classes");
double percentage = attendanceObject.GetNamedNumber("attendance_percentage");
course.Attendance = new Attendance(course, total, attended, percentage, classLength);
JsonArray detailsArray = attendanceObject.GetNamedArray("details");
foreach (JsonValue stubValue in detailsArray)
{
JsonObject stubObject = stubValue.GetObject();
DateTimeOffset classDate = new DateTimeOffset(DateTime.ParseExact(stubObject.GetNamedString("date"), "yyyy-MM-dd", CultureInfo.InvariantCulture), new TimeSpan(5, 30, 0));
course.Attendance.AddStubToDetails(classDate, new AttendanceStub(
stubObject.GetNamedString("slot"),
stubObject.GetNamedString("status"),
stubObject.GetNamedString("reason")));
}
}
示例7: Stream
//----------------------------------------------------------------------
public Stream( JsonObject aJsonObject )
{
Id = Convert.ToInt64( aJsonObject.GetNamedNumber( scIdString ) );
Game = aJsonObject.GetNamedString( scGameString );
Viewers = Convert.ToInt32( aJsonObject.GetNamedNumber( scViewersString ) );
VideoHeight = Convert.ToInt32( aJsonObject.GetNamedNumber( scVideoHeightString ) );
AverageFps = Convert.ToInt32( aJsonObject.GetNamedNumber( scAverageFpsString ) );
Delay = Convert.ToInt32( aJsonObject.GetNamedNumber( scDelayString ) );
CreatedAt = DateTime.Parse( aJsonObject.GetNamedString( scCreatedAtString ) );
IsPlaylist = aJsonObject.GetNamedBoolean( scIsPlaylistString );
Preview = aJsonObject.GetNamedObject( scPreviewString ).GetNamedString( "large" );
Links = new Links( aJsonObject.GetNamedObject( scLinksString ) );
Channel = new Channel( aJsonObject.GetNamedObject( scChannelString ) );
}
示例8: SetImageData
private async void SetImageData(JsonObject data, CreateTilePage_ImageViewModel m)
{
if (data.ContainsKey("src"))
{
await m.SetImageSource(data.GetNamedString("src"));
//m.RaisePropertyChanged("ImageSource");
}
m.ShowTitle = data.GetNamedBoolean("title");
}
示例9: ProcessStatus
private async Task ProcessStatus(JsonObject json)
{
if (GetResult(json) == 0)
{
// Retrieve status of delivery Mode
bool inDeliveryMode = json.GetNamedBoolean("InDeliveryMode");
SetTextBlock(txtDeliveryModeValue, inDeliveryMode.ToString(), greenBrush);
// Retrieve status of product flowing
bool isProductFlowing = json.GetNamedBoolean("ProductFlowing");
SetTextBlock(txtProductFlowingValue, isProductFlowing.ToString(), greenBrush);
// Retrieve status of error
bool inError = json.GetNamedBoolean("Error");
SetTextBlock(txtInErrorValue, inError.ToString(), greenBrush);
// Retrieve status of calibration
bool inCalibration = json.GetNamedBoolean("InCalibration");
SetTextBlock(txtInCalibrationValue, inCalibration.ToString(), greenBrush);
}
else
{
SetTextBlock(txtDeliveryModeValue, METER_DISCONNECTED, redBrush);
SetTextBlock(txtProductFlowingValue, METER_DISCONNECTED, redBrush);
SetTextBlock(txtInErrorValue, METER_DISCONNECTED, redBrush);
SetTextBlock(txtInCalibrationValue, METER_DISCONNECTED, redBrush);
}
await Task.Delay(1);
}
示例10: parseRawKeyboardData
private TextInputStatusInfo parseRawKeyboardData(JsonObject rawData)
{
var focused = false;
String contentType = null;
var predictionEnabled = false;
var correctionEnabled = false;
var autoCapitalization = false;
var hiddenText = false;
var focusChanged = false;
var keyboard = new TextInputStatusInfo {RawData = rawData};
try
{
if (rawData.ContainsKey("currentWidget"))
{
var currentWidget = rawData.GetNamedObject("currentWidget");
focused = currentWidget.GetNamedBoolean("focus");
if (currentWidget.ContainsKey("contentType"))
{
contentType = currentWidget.GetNamedString("contentType");
}
if (currentWidget.ContainsKey("predictionEnabled"))
{
predictionEnabled = currentWidget.GetNamedBoolean("predictionEnabled");
}
if (currentWidget.ContainsKey("correctionEnabled"))
{
correctionEnabled = currentWidget.GetNamedBoolean("correctionEnabled");
}
if (currentWidget.ContainsKey("autoCapitalization"))
{
autoCapitalization = currentWidget.GetNamedBoolean("autoCapitalization");
}
if (currentWidget.ContainsKey("hiddenText"))
{
hiddenText = currentWidget.GetNamedBoolean("hiddenText");
}
}
if (rawData.ContainsKey("focusChanged"))
focusChanged = rawData.GetNamedBoolean("focusChanged");
}
catch (Exception e)
{
throw e;
}
keyboard.Focused = focused;
keyboard.ContentType = contentType;
keyboard.PredictionEnabled = predictionEnabled;
keyboard.CorrectionEnabled = correctionEnabled;
keyboard.AutoCapitalization = autoCapitalization;
keyboard.HiddenText = hiddenText;
keyboard.FocusChanged = focusChanged;
return keyboard;
}