private async Task Json_Paring_Country(string json) { try { JObject obj = JObject.Parse(json); if (total_number == 0) { //Console.WriteLine(obj["total"].ToString()); total_number = int.Parse(obj["total"].ToString()); } JArray hotel_countries = JArray.Parse(obj["countries"].ToString()); foreach (JObject itemObj in hotel_countries) { CountryDesc contents = new CountryDesc(); contents.country_code = itemObj["code"].ToString(); contents.country_description = itemObj["description"]["content"].ToString(); HBCountryDescList.Add(contents); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void UserControl_Initialized(object sender, EventArgs e) { //numberOfData = "&from=" + from + "&to=" + to; ApiUrl_TB.Text = endpoint; Extract_btn.IsEnabled = false; //In Memory DB 불러오기. CountryDescMomoryDB = File.ReadAllLines(@"..\..\CSVfiles\CountryDesc.csv") .Skip(1) .Select(v => CountryDesc.FromCsv(v)) .ToList(); mainWindow = ((MainWindow)Application.Current.MainWindow); CountryDescMomoryDB.Insert(0, new CountryDesc() { country_code = "all", country_description = "All" }); country_Combo.ItemsSource = CountryDescMomoryDB; country_Combo.SelectedIndex = 0; }