public void Start(object args) { if (null != args) { //customInfo = (MTMCustInfo)args; // to do 数据绑定 healthDTO = (MTMHealthCollectDTO)args; Prism.Events.EventAggregator eventAggragator = ServiceLocator.Current.GetInstance <EventAggregator>(); eventAggragator.GetEvent <WebSocketEvent>().Subscribe(OnWebSocketEvent); } }
private void OnWebSocketEvent(object data) { Console.WriteLine("A5 ======== OK "); if (null != data) { healthDTO = data as MTMHealthCollectDTO; String foodString = ""; if (1 == healthDTO.eatingpreference) { foodString += "饮食偏好:高盐 "; } else if (2 == healthDTO.eatingpreference) { foodString += "饮食偏好:低盐 "; } else { foodString += "饮食偏好:未知 "; } textBlock2.Text = foodString; String smoking = ""; if (String.Equals("no", healthDTO.smoking)) { smoking += "抽烟:否"; } else if (String.Equals("yes", healthDTO.smoking)) { smoking += "抽烟:是"; } else { smoking += "抽烟:未知"; } textBlock11.Text = smoking; String drink = ""; if (String.Equals("no", healthDTO.drinking)) { drink += "酗酒:否"; } else if (String.Equals("yes", healthDTO.drinking)) { drink += "酗酒:是"; } else { drink += "酗酒:未知"; } textBlock12.Text = drink; textBlock3.Text = "身高:" + healthDTO.height + " CM"; textBlock13.Text = "体重:" + healthDTO.weight + " KG"; textBlock14.Text = "腹围:" + healthDTO.waist + " CM"; textBlock5.Text = "收缩压:" + healthDTO.systolicpressure + " mmHg"; textBlock15.Text = "舒张压:" + healthDTO.diastolicpressure + " mmHg"; textBlock7.Text = "空腹血糖:" + healthDTO.fastsugar; textBlock16.Text = "随机血糖:" + healthDTO.randomsugar; textBlock17.Text = "糖化血红蛋白:" + healthDTO.HbA1c; textBlock18.Text = "甘油三脂:" + healthDTO.triglyceride; textBlock9.Text = "总胆固醇:" + healthDTO.cholesterol; textBlock19.Text = "LDL-C:" + healthDTO.ldl; textBlock10.Text = "HDL-C:" + healthDTO.hdl; heartbeat.Text = "心率:" + healthDTO.heartrate + " 次/分"; TCHighest.Text = "TC最高值: " + healthDTO.agobloodfat_tcmaxvalue; LDLHeighest.Text = "LDL最高值: " + healthDTO.agobloodfat_ldlmaxvalue; HDLLowest.Text = "HDL最低值: " + healthDTO.agobloodfat_hdlminvalue; TGHighest.Text = "TG最高值:" + healthDTO.agobloodfat_tgmaxvalue; } }
private void OnWebSocketEvent(object data) { Console.WriteLine("A5 ======== OK "); if (null != data) { healthDTO = data as MTMHealthCollectDTO; String foodString = ""; if (1 == healthDTO.eatingpreference) { foodString += "饮食偏好:高盐 "; } else if (0 == healthDTO.eatingpreference) { foodString += "饮食偏好:低盐 "; } else { foodString += "饮食偏好:未知 "; } foodString += " "; if (String.Equals("no", healthDTO.smoking)) { foodString += "抽烟:否"; } else if (String.Equals("yes", healthDTO.smoking)) { foodString += "抽烟:是"; } else { foodString += "抽烟:未知"; } foodString += " "; if (String.Equals("no", healthDTO.drinking)) { foodString += "酗酒:否"; } else if (String.Equals("yes", healthDTO.drinking)) { foodString += "酗酒:是"; } else { foodString += "酗酒:未知"; } textBlock2.Text = foodString; String bodyString = ""; bodyString += "身高:" + healthDTO.height; bodyString += " "; bodyString += "体重:" + healthDTO.weight; bodyString += " "; bodyString += "腹围:" + healthDTO.waist; textBlock3.Text = bodyString; //heartrate.Text = "心率(次/分):" + healthDTO.heartrate; String pressure = ""; pressure += "收缩压:" + healthDTO.systolicpressure; pressure += " "; pressure += "舒张压:" + healthDTO.diastolicpressure; textBlock5.Text = pressure; String blood = ""; blood += "空腹血糖:" + healthDTO.fastsugar; blood += " "; blood += "随机血糖:" + healthDTO.randomsugar; blood += " "; blood += "糖化血红蛋白:" + healthDTO.HbA1c; textBlock7.Text = blood; String liveblood = ""; liveblood += "总胆固醇:" + healthDTO.cholesterol; liveblood += " "; liveblood += "甘油三脂:" + healthDTO.triglyceride; liveblood += " "; liveblood += "LDL-C:" + healthDTO.ldl; liveblood += " "; textBlock9.Text = liveblood; textBlock10.Text = "HDL-C:" + healthDTO.hdl; //=========================================== //if (1 == healthDTO.eatingpreference) // eatingpreference.Text = "饮食偏好:高盐"; //else if (0 == healthDTO.eatingpreference) // eatingpreference.Text = "饮食偏好:低盐"; //else // eatingpreference.Text = "饮食偏好:未知"; //if (String.Equals("no", healthDTO.smoking)) // smoking.Text = "是否抽烟:否"; //else if (String.Equals("yes", healthDTO.smoking)) // smoking.Text = "是否抽烟:是"; //else // smoking.Text = "是否抽烟:未知"; //if (String.Equals("no", healthDTO.drinking)) // drinking.Text = "是否酗酒:否"; //else if (String.Equals("yes", healthDTO.drinking)) // drinking.Text = "是否酗酒:是"; //else // drinking.Text = "是否酗酒:未知"; //height.Text = "身高(cm):"+healthDTO.height; //weight.Text = "体重(KG):"+healthDTO.weight; //waist.Text = "腹围(cm):"+healthDTO.waist; //heartrate.Text = "心率(次/分):" + healthDTO.heartrate; //systolicpressure.Text = "收缩压(mmol/L):" + healthDTO.systolicpressure; //diastolicpressure.Text = "舒张压(mmol/L):" + healthDTO.diastolicpressure; //fastsugar.Text = "空腹血糖(mmol/L):" + healthDTO.fastsugar; //randomsugar.Text = "随机血糖(mmol/L):" + healthDTO.randomsugar; //HbA1c.Text = "糖化血红蛋白(mmol/L):" + healthDTO.HbA1c; //cholesterol.Text = "总胆固醇:" + healthDTO.cholesterol; //triglyceride.Text = "甘油三脂:" + healthDTO.triglyceride; //ldl.Text = "LDL-C:" + healthDTO.ldl; //hdl.Text = "HDL-C:" + healthDTO.hdl; } }