黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -25,14 +25,9 @@
            ZbGateway.StatusList.Add(this);
            Application.RunOnMainThread(() =>
            {
                ControlCommonResourse.UpdateDoorLockStatusAction = (obj) =>
                {
                    UpdateNomallyOpenStatus();
                };
                UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += (DoorlockKey, status) =>
                {
                    var key = doorLock.DeviceAddr + doorLock.DeviceEpoint;
                    var key = doorLock.DeviceAddr;
                    if (DoorlockKey == key)
                    {
                        DoorLockCommonInfo.NormallyOpenModeValue(this.doorLock, status);
@@ -56,9 +51,9 @@
        /// </summary>
        DateTime waitGetDoorLockPower = DateTime.MaxValue;
        /// <summary>
        /// 逻辑中是否有常开模式
        /// 逻辑中是否有常开模式
        /// </summary>
        private bool haveLogicNormallyOpenMode = false;
        private bool haveLogicNormallyOpenMode = false;
        /// <summary>
        /// 当前电量
@@ -199,11 +194,11 @@
        bool IsClick = true;
        #endregion
        /// <summary>
        /// UI显示
        /// <summary>
        /// UI显示
        /// </summary>
        public void Show()
        {
        {
            this.TopFrameLayout(this, "");
            this.MidFrameLayout(this);
@@ -236,7 +231,7 @@
            ClickHandle();
            if (Common.LocalDevice.Current.CheckDeviceIsOnline(doorLock) == true)
            if (HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(doorLock) == true)
            {
                ReadDoorLockUserInfo();
            }
@@ -269,7 +264,7 @@
            btnDoorLockTitle.Y = Application.GetRealHeight(46);
            btnDoorLockTitle.TextSize = 15;
            btnDoorLockTitle.IsBold = true;
            btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock);
            btnDoorLockTitle.Text = HdlDeviceCommonLogic.Current.GetDeviceMacName(doorLock);
            btnDoorLockTitle.Width = btnDoorLockTitle.GetRealWidthByText();
            btnDoorLockTitle.TextAlignment = TextAlignment.Center;
            btnDoorLockTitle.Gravity = Gravity.CenterHorizontal;
@@ -310,9 +305,9 @@
                UnSelectedImagePath = "Item/Collection.png",
                SelectedImagePath = "Item/CollectionSelected.png"
            };
            btnCollectFrameLayout.AddChidren(btnCollect);
            //当前状态
            btnCollectFrameLayout.AddChidren(btnCollect);
            //当前状态
            btnStatus = new Button()
            {
                Width = Application.GetRealWidth(132 + 351),
@@ -337,9 +332,9 @@
                TextSize = 10,
                TextAlignment = TextAlignment.CenterLeft,
            };
            midTopFrameLayout.AddChidren(btnCurrentPowerText);
#if Android
            btnCurrentPowerText.X = btnStatus.Right + Application.GetRealWidth(20);
            midTopFrameLayout.AddChidren(btnCurrentPowerText);
#if Android
            btnCurrentPowerText.X = btnStatus.Right + Application.GetRealWidth(20);
#endif
            //门锁开/关图片
@@ -616,12 +611,12 @@
                    if (tempDoor.doorLockOperatingEventNotificationCommand != null)
                    {
                        //非主人不弹这个窗口
                        if (UserCenterResourse.UserInfo.AuthorityNo != 1)
                        {
                            return;
                        if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
                        {
                            return;
                        }
                        if (doorLock.IsDoorLockNormallyMode)
                        {
                        if (doorLock.IsDoorLockNormallyMode)
                        {
                            if (canOpenNormallyMode)
                            {
                                Application.RunOnMainThread(() =>
@@ -637,35 +632,6 @@
                    }
                }
            }
            //网关执行逻辑,常开模式失效上报
            //if (typeTag == "DoorLockAlarmsSendAlarmInform" && tempDevice != null)
            //{
            //    var doorL = (ZigBee.Device.DoorLock)tempDevice;
            //    if (doorL.DeviceAddr + doorL.DeviceEpoint == doorLock.DeviceAddr + doorLock.DeviceEpoint)
            //    {
            //        //非主人不弹这个窗口
            //        if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            //        {
            //            return;
            //        }
            //        if (doorLock.IsDoorLockNormallyMode)
            //        {
            //            if (canOpenNormallyMode)
            //            {
            //                Application.RunOnMainThread(() =>
            //                {
            //                    Action<bool> action = (obj) =>
            //                    {
            //                        UpdateNomallyOpenStatus();
            //                    };
            //                    DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.ServicePush, haveLogicNormallyOpenMode, action);
            //                });
            //            }
            //        }
            //    }
            //}
            if (typeTag == "DeviceStatusReport" && tempDevice != null)
            {
@@ -734,18 +700,18 @@
                            }
                            DoorLockCommonInfo.NormallyOpenModeValue(doorLock, tempRes);
                            //Application.RunOnMainThread(async () =>
                            //{
                            //var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3, doorLock);
                            //if (resTemp == 1)
                            //{
                            //    haveLogicNormallyOpenMode = true;
                            //}
                            //else if (resTemp == 0)
                            //{
                            //    haveLogicNormallyOpenMode = false;
                            //}
                            //});
                            Application.RunOnMainThread(async () =>
                            {
                                var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(2, doorLock);
                                if (resTemp == 0)
                                {
                                    haveLogicNormallyOpenMode = false;
                                }
                                else
                                {
                                    haveLogicNormallyOpenMode = true;
                                }
                            });
                        }
                    }
                    else
@@ -766,7 +732,7 @@
                        {
                            var listDevice = new List<CommonDevice> { };
                            listDevice.Add(doorLock);
                            var devTemp = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
                            var devTemp = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(listDevice);
                            if (devTemp.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone)
                            {
                                Application.RunOnMainThread(() =>
@@ -823,7 +789,7 @@
        public void ClickHandle()
        {
            //门锁标题
            btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock);
            btnDoorLockTitle.Text = HdlDeviceCommonLogic.Current.GetDeviceMacName(doorLock);
            //返回
            EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
@@ -897,8 +863,8 @@
            {
                if (doorLock.IsDoorLockNormallyMode)
                {
                    if (canOpenNormallyMode)
                    {
                    if (canOpenNormallyMode)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            Action<bool> action = (obj) =>
@@ -912,7 +878,7 @@
                    {
                        OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus);
                    }
                }
                }
                else
                {
                    OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus);
@@ -1088,13 +1054,13 @@
        /// </summary>
        private async void NomallyOpenDialog()
        {
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
            {
                this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
                return;
            }
            if (!UserCenterResourse.AccountOption.DoorUnLockByRemote)
            if (!HdlUserCenterResourse.AccountOption.DoorUnLockByRemote)
            {
                SystemSecondAuthentication();
                return;
@@ -1102,37 +1068,49 @@
            action = () =>
            {
                //系统密码支持操作门锁后,调用温居城的界面【常开自动化】
                if (doorLock == null)
                {
                //WJC的代码:系统密码支持操作门锁后,调用温居城的界面【常开自动化】
                if (doorLock == null)
                {
                    ///防止抛异常
                    return;
                }
                ///备注:WJC的
                Shared.Phone.Device.Logic.Send.CurrentDoorLock = doorLock;
                ///进来刷新一次设备列表;
                Common.Logic.LogicDviceList.Clear();
                if (Common.Logic.LogicDviceList.Count == 0)
                {
                    Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
                }
                var addLogicPage = new Shared.Phone.Device.Logic.SoneLogicList();
                UserView.HomePage.Instance.AddChidren(addLogicPage);
                UserView.HomePage.Instance.PageIndex += 1;
                addLogicPage.Show();
                addLogicPage.action += (w) =>
                {
                    doorLock.IsDoorLockNormallyMode = w;
                    UpdateNomallyOpenStatus();
                    //返回按键清空当前逻辑定义的LogicAction
                    UserCenter.DoorLock.DoorLockCommonInfo.LogicAction = null;
                };
                    return;
                }
                ///备注:WJC的
                Shared.Phone.Device.Logic.Send.CurrentDoorLock = doorLock;
                ///进来刷新一次设备列表;
                Common.Logic.LogicDviceList.Clear();
                if (Common.Logic.LogicDviceList.Count == 0)
                {
                    Common.Logic.LogicDviceList.AddRange(HdlDeviceCommonLogic.Current.listAllDevice.ToArray());
                }
                var addLogicPage = new Shared.Phone.Device.Logic.SoneLogicList();
                UserView.HomePage.Instance.AddChidren(addLogicPage);
                UserView.HomePage.Instance.PageIndex += 1;
                addLogicPage.Show();
                addLogicPage.action += async (w) =>
                 {
                     DoorLockCommonInfo.NormallyOpenModeValue(doorLock, w);
                     UpdateNomallyOpenStatus();
                     //返回按键清空当前逻辑定义的LogicAction
                     UserCenter.DoorLock.DoorLockCommonInfo.LogicAction = null;
                     //是否存在常开模式
                     var resTemp = Shared.Common.Logic.SoneLogicList;
                     if (resTemp.Count == 0)
                     {
                         haveLogicNormallyOpenMode = false;
                     }
                     else
                     {
                         haveLogicNormallyOpenMode = true;
                     }
                     UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction -= addLogicPage.updateCurrentDoorlockActionTemp;
                 };
            };
            HdlCheckLogic.Current.CheckSecondarySecurity(action);
        }
        /// <summary>
        }
        /// <summary>
        /// 常开模式状态更新
        /// </summary>
        private void UpdateNomallyOpenStatus()
@@ -1171,7 +1149,7 @@
        {
            openFrameLayout.Enable = false;
            btnDoorOpenPic.Enable = false;
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
            {
                var result = await DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
                if (result == false)
@@ -1214,8 +1192,8 @@
                {
                    if (!string.IsNullOrEmpty(deviceRename))
                    {
                        btnDoorLockTitle.Text = deviceRename;
                        //改房间
                        btnDoorLockTitle.Text = deviceRename;
                        //改房间
                        HdlRoomLogic.Current.ChangedRoom(deviceUI, currentRoom.Id);
                        deviceUI.ReSave();
                    }
@@ -1232,9 +1210,6 @@
        /// </summary>
        public override void RemoveFromParent()
        {
            //徐梅的门锁界面关闭(网关全局接收时使用)
            //ControlCommonResourse.IsDoorLockPageOpen = false;
            ControlCommonResourse.UpdateDoorLockStatusAction = null;
            UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction = null;
            if (IsDrawerLockMode)
            {