private async Task GetSampleDataAsync(string key, string bookKey) { if (this.BookKey == bookKey && this.BookUnitListDataSource != null) { return; } this.BookKey = bookKey; this.JsonLocalFileName = bookKey + "GetBookUnitList.json"; JsonDataUri = string.Format(JSON_URL, DateTime.Now.Ticks, bookKey); String jsonText = await GetJsonDataSource(); JsonObject jsonObject = JsonObject.Parse(jsonText); JsonArray jsonArray = jsonObject["Value"].GetArray(); this.BookUnitListDataSource = new BookUnitListDataSource(jsonObject["Code"].GetNumber(), jsonObject["Message"].GetString()); foreach (JsonValue bookValue in jsonArray) { JsonObject bookObject = bookValue.GetObject(); BookUnit bookUnit = new BookUnit(bookObject["Key"].GetString(), bookObject["UnitIndex"].GetString(), bookObject["Name"].GetString() ); this.BookUnitListDataSource.Value.Add(bookUnit); } }
private async Task GetSampleDataAsync(string key, string unitKey) { if (this.UnitKey == unitKey && this._bookUnitDataSource != null) { return; } this.UnitKey = unitKey; this.JsonLocalFileName = unitKey + "GetBookUnit.json"; JsonDataUri = string.Format(JSON_URL, DateTime.Now.Ticks, unitKey); String jsonText = await GetJsonDataSource(); JsonObject jsonObject = JsonObject.Parse(jsonText); JsonObject bookUnitValue = jsonObject["Value"].GetObject(); BookUnit bookUnit = new BookUnit(bookUnitValue["Key"].GetString(), bookUnitValue["UnitIndex"].GetString(), bookUnitValue["Name"].GetString()); this._bookUnitDataSource = new BookUnitDataSource(jsonObject["Code"].GetNumber(), jsonObject["Message"].GetString(), bookUnit); }
public BookUnitDataSource(double code, string message, BookUnit value) { Code = code; Message = message; Value = value; }