コード例 #1
0
        private async Task GetSampleDataAsync(string key, string unitKey)
        {
            if (this.UnitKey == unitKey && this._bookTextListDataSource != null)
            {
                return;
            }

            this.UnitKey           = unitKey;
            this.JsonLocalFileName = unitKey + "GetBookTextList.json";
            JsonDataUri            = string.Format(JSON_URL, DateTime.Now.Ticks, unitKey);
            String jsonText = await GetJsonDataSource();

            JsonObject jsonObject = JsonObject.Parse(jsonText);
            JsonArray  jsonArray  = jsonObject["Value"].GetArray();

            this._bookTextListDataSource = new BookTextListDataSource(jsonObject["Code"].GetNumber(), jsonObject["Message"].GetString());

            foreach (JsonValue bookValue in jsonArray)
            {
                JsonObject bookObject = bookValue.GetObject();
                BookText   bookUnit   = new BookText(bookObject["Key"].GetString(),
                                                     bookObject["Index"].GetString(),
                                                     bookObject["Name"].GetString(),
                                                     bookObject["Video"].GetString()
                                                     );

                this.BookTextListDataSource.Value.Add(bookUnit);
            }
        }
コード例 #2
0
        private async Task GetSampleDataAsync(string key, string textKey)
        {
            if (this.TextKey == textKey && this._bookTextDataSource != null)
            {
                return;
            }

            this.TextKey           = textKey;
            this.JsonLocalFileName = textKey + "GetBookText.json";
            JsonDataUri            = string.Format(JSON_URL, DateTime.Now.Ticks, textKey);
            String jsonText = await GetJsonDataSource();

            JsonObject jsonObject = JsonObject.Parse(jsonText);
            JsonObject bookObject = jsonObject["Value"].GetObject();
            BookText   bookText   = new BookText(bookObject["Key"].GetString(),
                                                 bookObject["Index"].GetString(),
                                                 bookObject["Name"].GetString(),
                                                 bookObject["Video"].GetString());

            this._bookTextDataSource = new BookTextDataSource(jsonObject["Code"].GetNumber(),
                                                              jsonObject["Message"].GetString(), bookText);
        }
コード例 #3
0
 public BookTextDataSource(double code, string message, BookText value)
 {
     Code    = code;
     Message = message;
     Value   = value;
 }