void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e) { Enttype ent = e.SelectedItem as Enttype; if (ent == null) { return; } //var busine = new BusinessDetailsPage(ent,1); Navigation.PushAsync(new BusinessDetailsPage(ent, 1)); lv.SelectedItem = null; }
public ClassificationPage(Enttype ent, BusinessDetailFlow flow) { InitializeComponent(); zonghe.WidthRequest = (App.ScreenWidth - (App.ScreenWidth / 10 + 10)) / 2 - 10; zonghe.HeightRequest = zonghe.WidthRequest * 273 / 326; ro.WidthRequest = (App.ScreenWidth - (App.ScreenWidth / 10 + 10)) / 2 - 10; ro.HeightRequest = zonghe.WidthRequest * 273 / 326; zhibiao.WidthRequest = (App.ScreenWidth - (App.ScreenWidth / 10 + 10)) / 2 - 10; zhibiao.HeightRequest = zonghe.WidthRequest * 273 / 326; yujing.WidthRequest = (App.ScreenWidth - (App.ScreenWidth / 10 + 10)) / 2 - 10; yujing.HeightRequest = zonghe.WidthRequest * 273 / 326; yujing1.Margin = new Thickness(0, 5, App.ScreenWidth / 2 - yujing.WidthRequest, 0); baojing.Margin = new Thickness(0, 40, App.ScreenWidth / 2 - yujing.WidthRequest, 0); yujing11.Margin = new Thickness(0, 5, App.ScreenWidth / 2 - yujing.WidthRequest, 0); baojing1.Margin = new Thickness(0, 40, App.ScreenWidth / 2 - yujing.WidthRequest, 0); NavigationPage.SetBackButtonTitle(this, ""); this.Title = ent.name; _ent = ent; _flow = flow; BackgroundWorker wrk = new BackgroundWorker(); wrk.DoWork += (sender, e) => { makeData(); }; wrk.RunWorkerCompleted += (sender, e) => { if (aaaa != null) { for (int i = 0; i < aaaa.Count; i++) { resutlDic dic = aaaa[i]; //报警 if (dic.counttype == "1") { baojing1.Text = dic.count; } //预警 if (dic.counttype == "2") { yujing11.Text = dic.count; } } } }; wrk.RunWorkerAsync(); }
public BusinessDetailsPage(Enttype ent, int type) { InitializeComponent(); NavigationPage.SetBackButtonTitle(this, ""); this.Title = ent.name; _ent = ent; if (type == 0) { NavigationPage.SetHasBackButton(this, false); } //BusinessName.Text = ent.name; //alarmBut.IsVisible = (bool)ent.alarm; //if (ent.alert == true) //alertBut.IsVisible = (bool)ent.alert; lastBut = gongyishuBut; BackgroundWorker wrk = new BackgroundWorker(); wrk.DoWork += (sender, e) => { CrossHud.Current.Show("请求中。。。"); makeData(); }; wrk.RunWorkerCompleted += (sender, e) => { //desalination.Text = details.desalination; //recovery.Text = details.recovery; //avgrecovery.Text = details.avgrecovery; //infoLab.Text = _ent.addr + details.remark; //listV.ItemsSource = details.flow; for (int i = 0; i < details.flow.Count; i++) { BusinessDetailFlow flow = details.flow[i]; if (flow.flowtype == "0") { _GYSList.Add(flow); } if (flow.flowtype == "1") { _XHSList.Add(flow); } if (flow.flowtype == "2") { _GYFSList.Add(flow); } } listV.ItemsSource = _GYSList; CrossHud.Current.Dismiss(); }; wrk.RunWorkerAsync(); }
//item刚出现 void Handle_ItemAppearing(object sender, Xamarin.Forms.ItemVisibilityEventArgs e) { Enttype item = e.Item as Enttype; if (item == dataList[dataList.Count - 1] && haveMole == true && item != null) { pageIndex += 1; BackgroundWorker wrk = new BackgroundWorker(); wrk.DoWork += (sender1, e1) => { makeData(); }; wrk.RunWorkerAsync(); } }
void makeData() { try { string url = App.BaseURL + "AppEnterprise/GeteEnterpriseByKey?searchKey=" + searchB.Text + "&pageIndex=" + pageIndex + "&pageSize=30"; Console.WriteLine("请求url:" + url); string result = EasyWebRequest.sendGetHttpWebRequest(url); Console.WriteLine("请求结果:" + result); var retv = JsonConvert.DeserializeObject <entlisttype>(result); if (retv == null) { DisplayAlert("retv null", result, "OK"); } if (pageIndex == 0) { dataList.Clear(); } for (int i = 0; i < retv.Items.Count; i++) { Enttype item = retv.Items[i]; dataList.Add(item); } if (retv.Totals <= dataList.Count) { haveMole = false; } else { haveMole = true; } } catch (Exception ex) { DisplayAlert("Alert", ex.Message, "OK"); } }