示例#1
0
        private void OnHttp()
        {
            string         result         = _httpRequest.Get("https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5", null, null);
            nCoVData       data           = JsonConvert.DeserializeObject <nCoVData>(result);
            nCoVDataDetail nCoVDataDetail = JsonConvert.DeserializeObject <nCoVDataDetail>(data.Data);

            this.lbConfirm.Text = nCoVDataDetail.ChinaTotal.Confirm.ToString();
            this.lbSuspect.Text = nCoVDataDetail.ChinaTotal.Suspect.ToString();
            this.lbHeal.Text    = nCoVDataDetail.ChinaTotal.Heal.ToString();
            this.lbDead.Text    = nCoVDataDetail.ChinaTotal.Dead.ToString();

            this.lbAddConfirm.Text = nCoVDataDetail.ChinaAdd.Confirm.ToString();
            this.lbAddSuspect.Text = nCoVDataDetail.ChinaAdd.Suspect.ToString();
            this.lbAddHeal.Text    = nCoVDataDetail.ChinaAdd.Heal.ToString();
            this.lbAddDead.Text    = nCoVDataDetail.ChinaAdd.Dead.ToString();

            this.chartTotal.Series[0].Points.Clear();
            this.chartTotal.Series[1].Points.Clear();
            foreach (var child in nCoVDataDetail.ChinaDayList)
            {
                this.chartTotal.Series[0].Points.AddXY(child.Date, child.Confirm);
            }

            foreach (var child in nCoVDataDetail.ChinaDayList)
            {
                this.chartTotal.Series[1].Points.AddXY(child.Date, child.Suspect);
            }
            this.chartAdd.Series[0].Points.Clear();
            foreach (var child in nCoVDataDetail.ChinaDayAddList)
            {
                this.chartAdd.Series[0].Points.AddXY(child.Date, child.Confirm);
            }
        }
示例#2
0
        public static void getData(object source, System.Timers.ElapsedEventArgs e)
        {
            HttpClient httpClient = new HttpClient {
                BaseAddress = new Uri("https://view.inews.qq.com/")
            };
            HttpResponseMessage httpResponseMessage = httpClient.GetAsync("g2/getOnsInfo?name=disease_h5").GetAwaiter().GetResult();
            var            result         = httpResponseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            nCoVData       data           = JsonConvert.DeserializeObject <nCoVData>(result);
            nCoVDataDetail nCoVDataDetail = JsonConvert.DeserializeObject <nCoVDataDetail>(data.Data);

            GetPositionOfJson(nCoVDataDetail.AreaTree);
            SaveToFile(JsonConvert.SerializeObject(dic, Formatting.Indented));
        }