/// <summary> /// 请求生化微小气候,比较耗时 /// </summary> private void shwxqhRequest() { ChemicalToxic chemicalToxic = Shwxqhxy.getchemdata(); Bioaerosol bioaerosol = Shwxqhxy.getbiodata(); Microclimate microlimate = Shwxqhxy.getendata(); if (this.IsHandleCreated && !this.IsDisposed) { //使用异步UI线程更新 this.BeginInvoke((MethodInvoker) delegate() { if (this.IsHandleCreated && !this.IsDisposed) { updateSHWXQH(chemicalToxic, bioaerosol, microlimate); } }); } }
private void updateSHWXQH(ChemicalToxic chemicalToxic, Bioaerosol bioaerosol, Microclimate microlimate) { if (chemicalToxic != null) { this.navBarItem_huaxue.Caption = chemicalToxic.gastype + ":" + chemicalToxic.reading; } else { this.navBarItem_huaxue.Caption = "化学毒剂在线监测系统无法连接,请检查!"; } if (bioaerosol != null) { //超标 if (!String.IsNullOrWhiteSpace(bioaerosol.error)) { MessageBox.Show("生物气溶剂超标了!-->是否需要关闭所有的闸机-->是否需要弹出应急预案", "超标"); } this.navBarItem_shengwu.Caption = bioaerosol.Status + " " + bioaerosol.reading; } else { this.navBarItem_shengwu.Caption = "生物气溶胶在线监测系统无法连接,请检查!"; } if (microlimate != null) { this.navBarItem_weixiaoqihou.Caption = microlimate.Temperature + "\n" + microlimate.Humidity + "\n" + microlimate.Lux + "\n" + microlimate.Pm + "\n" + microlimate.Pressure + "\n" + microlimate.Co + "\n" + microlimate.Co2 + "\n" + microlimate.Ms + "\n" + microlimate.Hcho + "\n" + microlimate.Db; } else { this.navBarItem_weixiaoqihou.Caption = "微小气候在线监测系统无法连接,请检查!"; } }