| | |
| | | } |
| | | if (btn.Tag.ToString() == function.sid) |
| | | { |
| | | if (function.online) |
| | | if (function.isOnline()) |
| | | { |
| | | btn.UnSelectedImagePath = "Collection/Functionbg.png"; |
| | | btn.IsSelected = false; |
| | |
| | | } |
| | | else if (btn.Tag.ToString() == "OnlineTag") |
| | | { |
| | | btn.Visible = !function.online; |
| | | btn.Visible = !function.isOnline(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新功能组控主页 |
| | | /// </summary> |
| | | public static void RefreshGroupControlView() |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | |
| | | if (FunctionList.List.groupControls.Count == 0) |
| | | { |
| | | bodyView.loadNavView(); |
| | | bodyView.contentView.PageIndex = 0; |
| | | } |
| | | bodyView.LoadGroupControlFunctionControlZone(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新连接状态图标 |
| | | /// </summary> |
| | | void CheckLinkStatus() |
| | |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (bodyView != null) |
| | | try |
| | | { |
| | | bodyView.CheckLinkStatus(); |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.CheckLinkStatus(); |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log($"LoadEvent_CheckLinkStatus : {ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | |
| | | /// </summary> |
| | | void LoadEvent_ChangeShowedFunctionType() |
| | | { |
| | | btnChangeFunction.MouseUpEventHandler = (sender, e) => |
| | | |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl && FunctionList.List.groupControls.Count>0) |
| | | { |
| | | btnChangeFunction.IsSelected = true; |
| | | btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize; |
| | | btnChangeFunction.IsBold = true; |
| | | btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; |
| | | btnChangeScene.IsSelected = false; |
| | | btnChangeScene.IsBold = false; |
| | | CurShowTypeIsFunction = true; |
| | | contentView.PageIndex = 0; |
| | | }; |
| | | |
| | | //var client = new BlufiClient(); |
| | | //client.PostPackageLengthLimit = 128; |
| | | //client.RequestDeviceScan(); |
| | | //client.RequestDeviceStatus(); |
| | | //client.BlufiDelegate.Blufi_DidReceiveDeviceScanResponse(); |
| | | |
| | | |
| | | btnChangeScene.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnChangeScene.IsSelected = true; |
| | | btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize; |
| | | btnChangeScene.IsBold = true; |
| | | btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; |
| | | btnChangeFunction.IsSelected = false; |
| | | btnChangeFunction.IsBold = false; |
| | | CurShowTypeIsFunction = false; |
| | | contentView.PageIndex = 1; |
| | | }; |
| | | |
| | | contentView.PageChange = (sender, e) => |
| | | { |
| | | if (contentView.PageIndex == 0) |
| | | { |
| | | btnChangeFunction.IsSelected = true; |
| | | btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize; |
| | | btnChangeFunction.IsBold = true; |
| | | btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; |
| | | btnChangeScene.IsSelected = false; |
| | | btnChangeScene.IsBold = false; |
| | | } |
| | | else |
| | | { |
| | | btnChangeScene.IsSelected = true; |
| | | btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize; |
| | | btnChangeScene.IsBold = true; |
| | | btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; |
| | | btnChangeFunction.IsSelected = false; |
| | | btnChangeFunction.IsBold = 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 |
| | |
| | | { |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!function.online)//离线不允许操作 |
| | | if (!function.isOnline())//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | MaxWidth = Application.GetRealWidth(300), |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | }); |
| | | } |
| | | |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB) |
| | |
| | | d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | else if (function.spk == SPK.PanelSocket) |
| | | //else if (function.spk == SPK.PanelSocket)//去掉,统一处理总控 |
| | | //{ |
| | | // if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null) |
| | | // { |
| | | // d.Add("on_off_usb", function.trait_on_off.curValue.ToString()); |
| | | // } |
| | | // Control.Ins.SendWriteCommand(function, d); |
| | | //} |
| | | else if (function.spk == SPK.GroupControl) |
| | | { |
| | | if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null) |
| | | { |
| | | d.Add("on_off_usb", function.trait_on_off.curValue.ToString()); |
| | | } |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | (function as GroupControl).Control(d); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!function.online)//离线不允许操作 |
| | | if (!function.isOnline())//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | MaxWidth = Application.GetRealWidth(300), |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | |
| | | { |
| | | btnClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!curtain.online)//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | MaxWidth = Application.GetRealWidth(300), |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | //if (!curtain.isOnline())//离线不允许操作 |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | btnClose.IsSelected = true; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!curtain.online)//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | MaxWidth = Application.GetRealWidth(300), |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | //if (!curtain.isOnline())//离线不允许操作 |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // 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); |
| | | }; |
| | |
| | | }; |
| | | btnUp.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!function.online)//离线不允许操作 |
| | | if (!function.isOnline())//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | MaxWidth = Application.GetRealWidth(300), |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | |
| | | }; |
| | | btnDown.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!function.online)//离线不允许操作 |
| | | if (!function.isOnline())//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | MaxWidth = Application.GetRealWidth(300), |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | |
| | | skipPage.LoadPage(backAction); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnMsgBg.MouseUpEventHandler = eventHandler; |
| | | btnMsgTime.MouseUpEventHandler = eventHandler; |
| | | btnMsg.MouseUpEventHandler = eventHandler; |
| | | //btnMsgBg.MouseUpEventHandler = eventHandler; |
| | | //btnMsgTime.MouseUpEventHandler = eventHandler; |
| | | //btnMsg.MouseUpEventHandler = eventHandler; |
| | | btnMsgIcon.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | void GetUnreadPushMessages() |
| | | { |
| | | if (MainPage.NoLoginMode) |
| | | { |
| | | return; |
| | | } |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | try |
| | |
| | | void ShowMesBtnState(PushMessageInfo pushMessageInfo, bool allRead) |
| | | { |
| | | if (bodyView == null) return; |
| | | btnMsg.Text = pushMessageInfo.messageTitle + ": " + pushMessageInfo.messageContent; |
| | | btnMsgTime.Text = GetUnixToDateTime(pushMessageInfo.createTime); |
| | | //btnMsg.Text = pushMessageInfo.messageTitle + ": " + pushMessageInfo.messageContent; |
| | | //btnMsgTime.Text = GetUnixToDateTime(pushMessageInfo.createTime); |
| | | btnMsgIcon.IsSelected = !allRead; |
| | | } |
| | | |
| | |
| | | void ResetMesBtnRead() |
| | | { |
| | | if (bodyView == null) return; |
| | | btnMsg.Text = "..."; |
| | | btnMsgTime.Text = "00:00"; |
| | | //btnMsg.Text = "..."; |
| | | //btnMsgTime.Text = "00:00"; |
| | | btnMsgIcon.IsSelected = false; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | void RegisterGetPushMessageAction() |
| | | { |
| | | if (MainPage.NoLoginMode) |
| | | { |
| | | return; |
| | | } |
| | | Action RegisterGetPushMessageAction = () => { |
| | | if (bodyView != null) |
| | | { |