| | |
| | | |
| | | if (!Control.Ins.GatewayOnline_Local && !Control.Ins.GatewayOnline_Cloud) |
| | | { |
| | | bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail; |
| | | bodyView.btnLinkStateTip.TextID = StringId.NetworkAnomaly; |
| | | bodyView.environmentalView.Y = Application.GetRealHeight(8) + btnResidenceName.Bottom; |
| | | bodyView.divLinkStateTip.Visible = true; |
| | | } |
| | | //else if () |
| | | //{ |
| | | // bodyView.divLinkStateTip.Visible = true; |
| | | //} |
| | | else |
| | | { |
| | | bodyView.btnLinkStateTip.BackgroundColor = 0x00000000; |
| | | bodyView.btnLinkStateTip.Text = ""; |
| | | bodyView.environmentalView.Y = Application.GetRealHeight(1) + btnResidenceName.Bottom; |
| | | bodyView.divLinkStateTip.Visible = false; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | object lockObj = new object(); |
| | | |
| | | /// <summary> |
| | | /// 更新显示状态 |
| | | /// </summary> |
| | | public static void UpdataFunctionStates(Function function) |
| | | { |
| | | if(bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | } |
| | | else if(function.spk == SPK.SensorHelp) |
| | | else if (function.spk == SPK.SensorHelp) |
| | | { |
| | | var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); |
| | | if(tempStatus != null) |
| | | if (tempStatus != null) |
| | | { |
| | | state = tempStatus.curValue.ToString() == "alarm"; |
| | | } |
| | | } |
| | | else if (function.spk == SPK.SensorPir || function.spk == SPK.SensorPirHold) |
| | | { |
| | | var tempStatus = function.attributes.Find((sta) => sta.key == "people_status"); |
| | | if (tempStatus != null) |
| | | { |
| | | state = tempStatus.curValue.ToString() == "true"; |
| | | } |
| | | } |
| | | else if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2) |
| | | { |
| | | var tempStatus = function.attributes.Find((sta) => sta.key == "contact_status"); |
| | | if (tempStatus != null) |
| | | { |
| | | state = tempStatus.curValue.ToString() == "open"; |
| | | } |
| | | } |
| | | else |
| | |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!curtain.isOnline())//离线不允许操作 |
| | |
| | | // return; |
| | | //} |
| | | btnOpen.IsSelected = true; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 100); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |