| | |
| | | /// <param name="updataFunction"></param> |
| | | public void UpdataStates(Function updataFunction, FrameLayout view, VerticalScrolViewLayout scrolView, Room room = null) |
| | | { |
| | | if (view == null || scrolView == null || updataFunction == null) |
| | | { |
| | | return; |
| | | } |
| | | Application.RunOnMainThread((() => |
| | | { |
| | | try |
| | | { |
| | | if (view == null || scrolView == null || updataFunction == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!scrolView.ScrollEnabled) |
| | | { |
| | | return; |
| | |
| | | { |
| | | #region 窗帘更新 |
| | | var onoffString = updataFunction.GetAttrState(FunctionAttributeKey.OnOff); |
| | | var percentAttr = updataFunction.GetAttribute(FunctionAttributeKey.Percent); |
| | | if(percentAttr != null) |
| | | { |
| | | onoffString = percentAttr.curValue.ToString() == "0" ? "off" : "on"; |
| | | } |
| | | |
| | | if (onoffString == "stop") |
| | | { |
| | | return; |
| | |
| | | } |
| | | #endregion |
| | | } |
| | | //更新毫米波传感器状态 |
| | | else if(SPK.SenesorMegahealth == updataFunction.spk || SPK.SensorMmvPose == updataFunction.spk) |
| | | { |
| | | if (cTag == updataFunction.sid + "_SenesorMegahealth_Status") |
| | | { |
| | | try |
| | | { |
| | | Button btnStatus = (fcView.GetChildren(j) as Button); |
| | | |
| | | var tempStatus = updataFunction.attributes.Find((sta) => sta.key == FunctionAttributeKey.TargetStatus); |
| | | if (tempStatus != null) |
| | | { |
| | | |
| | | switch (tempStatus.state) |
| | | {//0空,1走,2跑,3坐,4跌倒,5站 |
| | | case "0": |
| | | btnStatus.TextID = StringId.wuren; |
| | | btnStatus.TextColor = CSS_Color.MainColor; |
| | | break; |
| | | case "1": |
| | | btnStatus.TextID = StringId.SomeoneIn; |
| | | break; |
| | | case "2": |
| | | if (updataFunction.extSet.labModel) |
| | | { |
| | | btnStatus.TextID = StringId.SomeoneRunning; |
| | | } |
| | | else |
| | | { |
| | | btnStatus.TextID = StringId.Someone; |
| | | } |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | break; |
| | | case "3": |
| | | if (updataFunction.extSet.labModel) |
| | | { |
| | | btnStatus.TextID = StringId.SomeoneSitting; |
| | | } |
| | | else |
| | | { |
| | | btnStatus.TextID = StringId.Someone; |
| | | } |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | break; |
| | | case "4": |
| | | btnStatus.TextID = StringId.SomeoneFell; |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | break; |
| | | case "5": |
| | | if (updataFunction.extSet.labModel) |
| | | { |
| | | btnStatus.TextID = StringId.SomeoneStanding; |
| | | } |
| | | else |
| | | { |
| | | btnStatus.TextID = StringId.Someone; |
| | | } |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"{this.GetType()} error 3 : {ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | else if (SPK.ArmSensorSpkList().Contains(updataFunction.spk)) |
| | | { |
| | | if (cTag == updataFunction.sid + "_Sensor_Status") |
| | | { |
| | | Button btnStatus = (fcView.GetChildren(j) as Button); |
| | | |
| | | var alarm_status = updataFunction.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); |
| | | if (alarm_status != null) |
| | | { |
| | | if (alarm_status.curValue.ToString() == "normal") |
| | | { |
| | | btnStatus.TextID = StringId.SensorNormalState; |
| | | btnStatus.TextColor = CSS_Color.MainColor; |
| | | } |
| | | else |
| | | { |
| | | btnStatus.TextID = StringId.InAlarm; |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alarm_status = updataFunction.attributes.Find((sta) => sta.key == "contact_status"); |
| | | if (alarm_status != null) |
| | | { |
| | | if (alarm_status.curValue.ToString() == "close") |
| | | { |
| | | btnStatus.TextID = StringId.Shut; |
| | | btnStatus.TextColor = CSS_Color.MainColor; |
| | | } |
| | | else |
| | | { |
| | | if (updataFunction.spk == SPK.SensorDryContact || updataFunction.spk == SPK.SensorDryContact2) |
| | | { |
| | | btnStatus.TextID = StringId.DryBreak; |
| | | } |
| | | else |
| | | { |
| | | btnStatus.TextID = StringId.Open; |
| | | } |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alarm_status = updataFunction.attributes.Find((sta) => sta.key == "people_status"); |
| | | if (alarm_status != null) |
| | | { |
| | | if (alarm_status.curValue.ToString() == "false") |
| | | { |
| | | btnStatus.TextID = StringId.wuren; |
| | | btnStatus.TextColor = CSS_Color.MainColor; |
| | | } |
| | | else |
| | | { |
| | | btnStatus.TextID = StringId.youren; |
| | | btnStatus.TextColor = CSS_Color.WarningColor; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //更新温控器状态 |
| | | else if(SPK.HvacCac == updataFunction.spk) |
| | | { |
| | | if (cTag == updataFunction.sid + "_Humidity") |
| | | { |
| | | (fcView.GetChildren(j) as Button).Text = updataFunction.GetAttrState(FunctionAttributeKey.RoomHumidity) + "%"; |
| | | } |
| | | else if (cTag == updataFunction.sid + "_Temp") |
| | | { |
| | | (fcView.GetChildren(j) as Button).Text = updataFunction.GetAttrState(FunctionAttributeKey.RoomTemp) + "°C"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (scrolView.GetChildren(i).GetType() == typeof(FunctionControlZone)) { |
| | | var fcView = scrolView.GetChildren(i) as FunctionControlZone; |
| | | fcView.UpdataOnline(updataFunction.online); |
| | | fcView.UpdataOnline(updataFunction.isOnline()); |
| | | } |
| | | } |
| | | } |