private async void BtnSearch_Clicked(object sender, EventArgs e) { try { if (cboDong.SelectedItem == null) { return; } Popupage page = new Popupage(); await PopupNavigation.Instance.PushAsync(page); //await Task.Delay(5000); //MessagingCenter.Send<APTTransList>(this, "Hi"); lb_cnt.Text = "(0)"; textBox1.Text = String.Empty; string code = ((KeyValuePair <string, string>)cboDong.SelectedItem).Key; if (_dt == null) { _dt = _MakeDataTable(); } else { _dt.Rows.Clear(); } string url = String.Empty; for (int i = 1; i < 100; i++) { url = String.Format("https://m.land.naver.com/complex/getComplexArticleList?hscpNo={0}&tradTpCd=A1%3AB1%3AB2&order=point_&showR0=N&page={1}", code, i); string aaa = HttpCommunicator.GetAPTSellInfo(url); JObject jo = JObject.Parse(aaa); JObject _info = (JObject)jo["result"]; JArray _list = (JArray)_info["list"]; if (_list.Count == 0) { break; } DataRow adr; foreach (JToken item in _list) { if (item["tradTpNm"].ToString() != "매매") { continue; } adr = _dt.NewRow(); string _apt = item["atclNm"].ToString(); string _dong = item["bildNm"].ToString(); //string _spec = item["spc2"].ToString() + "/" + item["spc1"].ToString(); string _spec = item["spc2"].ToString(); string _flr = item["flrInfo"].ToString(); string _indate = item["cfmYmd"].ToString(); string _price = item["prcInfo"].ToString(); adr[0] = _price; adr[1] = _spec + "(" + _dong + _flr.Split(new char[] { '/' })[0] + "층)_{" + _indate + "}"; _dt.Rows.Add(adr); } } DataView dtv = _dt.DefaultView; dtv.Sort = "PRICE"; _dt = dtv.ToTable(); foreach (DataRow item in _dt.Rows) { string text = "[" + item[0].ToString().Trim() + "]_" + item[1].ToString().Trim(); text += Environment.NewLine; textBox1.Text += text; } lb_cnt.Text = "(" + _dt.Rows.Count + ")"; MessagingCenter.Send <APTTransList>(this, "Hi"); } catch (Exception ex) { await DisplayAlert("", ex.Message, "확인"); } }
private void BtnSearch2_Clicked(object sender, EventArgs e) { try { textBox2.Text = String.Empty; string loc = cboloc.SelectedItem.ToString().Trim(); if (String.IsNullOrEmpty(loc)) { return; } string dong = cboDong.SelectedItem.ToString().Trim(); if (String.IsNullOrEmpty(dong)) { return; } string apt = cboApt.SelectedItem.ToString().Trim(); if (String.IsNullOrEmpty(apt)) { return; } string code = String.Empty; //code = MemoraData.GetAptCode(apt, codelist); code = HttpCommunicator.GetAPTCode(apt); JObject a = JObject.Parse(code); if (a["AccessSts"].ToString().Trim() == String.Empty) { DisplayAlert("", "코드정보가 없습니다.", "확인"); return; } else { code = a["AccessSts"].ToString().Trim(); } if (_dt == null) { _dt = _MakeDataTable(); } else { _dt.Rows.Clear(); } string url = String.Empty; for (int i = 1; i < 100; i++) { url = String.Format("https://m.land.naver.com/complex/getComplexArticleList?hscpNo={0}&tradTpCd=A1%3AB1%3AB2&order=point_&showR0=N&page={1}", code, i); string aaa = HttpCommunicator.GetAPTSellInfo(url); JObject jo = JObject.Parse(aaa); JObject _info = (JObject)jo["result"]; JArray _list = (JArray)_info["list"]; if (_list.Count == 0) { break; } DataRow adr; foreach (JToken item in _list) { if (item["tradTpNm"].ToString() != "매매") { continue; } adr = _dt.NewRow(); string _apt = item["atclNm"].ToString(); string _dong = item["bildNm"].ToString(); //string _spec = item["spc2"].ToString() + "/" + item["spc1"].ToString(); string _spec = item["spc2"].ToString(); string _flr = item["flrInfo"].ToString(); string _indate = item["cfmYmd"].ToString(); string _price = item["prcInfo"].ToString(); adr[0] = _price; adr[1] = _spec + "(" + _dong + _flr.Split(new char[] { '/' })[0] + "층)_{" + _indate + "}"; _dt.Rows.Add(adr); //string text = "[" + _price + "]_" + _spec + "(" + _dong + _flr.Split(new char[] { '/' })[0] + "층)_{" + _indate + "}"; //text += Environment.NewLine; //textBox2.Text += text; } } DataView dtv = _dt.DefaultView; dtv.Sort = "PRICE"; _dt = dtv.ToTable(); foreach (DataRow item in _dt.Rows) { string text = "[" + item[0].ToString().Trim() + "]_" + item[1].ToString().Trim(); text += Environment.NewLine; textBox2.Text += text; } } catch (Exception ex) { DisplayAlert("", ex.Message, "확인"); } }