当前位置: 首页>>代码示例>>C#>>正文


C# JsonObject.GetNamedBoolean方法代码示例

本文整理汇总了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");
 }
开发者ID:kureuil,项目名称:Taper,代码行数:15,代码来源:SlackChannel.cs

示例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;
        }
开发者ID:WombatWorks,项目名称:windows10-sdk,代码行数:26,代码来源:JsonHelper.cs

示例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();
            }
        }
开发者ID:rishabhbanga,项目名称:CK.HomeAutomation,代码行数:15,代码来源:IOBoardManager.cs

示例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();
            }
        }
开发者ID:rishabhbanga,项目名称:CK.HomeAutomation,代码行数:13,代码来源:IOBoardManager.cs

示例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);
        }
开发者ID:gitter-badger,项目名称:VITacademics_Windows,代码行数:36,代码来源:JsonParser.cs

示例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")));
            }
        }
开发者ID:gitter-badger,项目名称:VITacademics_Windows,代码行数:31,代码来源:JsonParser.cs

示例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 ) );
 }
开发者ID:alanebro82,项目名称:Twitch,代码行数:15,代码来源:StreamSearchResults.cs

示例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");
 }
开发者ID:999eagle,项目名称:StartMenuTiles,代码行数:9,代码来源:CreateTilePageViewModel.cs

示例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);
        }
开发者ID:AlanMurphy924,项目名称:PhoneMeterMate,代码行数:34,代码来源:MainPage.xaml.cs

示例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;
        }
开发者ID:DmitrySigaev,项目名称:Connect-SDK-Windows,代码行数:59,代码来源:WebOsTvKeyboardInput.cs


注:本文中的JsonObject.GetNamedBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。