Example #1
0
        private async void BtnConnect_ClickAsync(object sender, EventArgs e)
        {
            if (txtNo.Text == string.Empty)
            {
                return;
            }
            ClearDisplayArea();

            probrem = await HttpClientManager.ExecuteGetXMLAsync <Probrem>(string.Format(API_AOJ_OLD, ID));

            probrem.id   = probrem.id.Replace("\n", string.Empty);
            probrem.name = probrem.name.Replace("\n", string.Empty);

            var responce2 = await HttpClientManager.ExecuteGetJsonAsync <Probrem2>(string.Format(API_AOJ_NEW, ID));

            var parser = new HtmlParser();
            var doc    = parser.ParseDocument(responce2.html);

            txtTitle.Text = string.Format("AOJ {0} ({1} : {2})", ID, probrem.name, doc.QuerySelectorAll("h1")[0].TextContent);

            string text = "";

            using (StreamReader sr = new StreamReader("ContentsTemplate.txt", Encoding.GetEncoding("UTF-8")))
            {
                text = sr.ReadToEnd();
            }
            txtContents.Text = string.Format(text, ID);
        }