黄学彪
2020-04-29 b68cdc7e103a00d5df73e4b75603be8da1815b4a
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -47,7 +47,7 @@
        /// </summary>
        bool canVolume = false;
        /// <summary>
        /// 保留上一次音量
        /// 是否支持常开
        /// </summary>
        bool canOpenNormallyMode = false;
        /// <summary>
@@ -90,6 +90,7 @@
        /// 设置FrameLayout
        /// </summary>
        FrameLayout btnFuncSetFrameLayout;
        FrameLayout progressFrameLayoutMatch;
        /// <summary>
        /// 点击开布局
        /// </summary>
@@ -207,8 +208,8 @@
            btnFuncSet = new Button
            {
                X = Application.GetRealWidth(103),
                Height = Application.GetRealHeight(69),
                Width = Application.GetRealWidth(69),
                Height = Application.GetMinReal(69),
                Width = Application.GetMinReal(69),
                UnSelectedImagePath = "DoorLock/SettingIcon.png",
            };
            btnFuncSetFrameLayout.AddChidren(btnFuncSet);
@@ -269,8 +270,8 @@
            midTopFrameLayout.AddChidren(btnRecordFrameLayout);
            btnRecord = new Button()
            {
                Width = Application.GetRealWidth(69),
                Height = Application.GetRealHeight(69),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                X = Application.GetRealWidth(46),
                Y = Application.GetRealHeight(46),
                UnSelectedImagePath = "DoorLock/RecordIcon.png",
@@ -287,8 +288,8 @@
            midTopFrameLayout.AddChidren(btnCollectFrameLayout);
            btnCollect = new Button()
            {
                Width = Application.GetRealWidth(69),
                Height = Application.GetRealHeight(69),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                X = Application.GetRealWidth(15),
                Y = Application.GetRealHeight(46),
                UnSelectedImagePath = "Item/Collection.png",
@@ -329,8 +330,8 @@
            //门锁开/关图片
            btnDoorLockPic = new Button()
            {
                Width = Application.GetRealWidth(383),
                Height = Application.GetRealHeight(343),
                Width = Application.GetMinReal(383),
                Height = Application.GetMinReal(343),
                X = Application.GetRealWidth(161),
                Y = Application.GetRealHeight(415),
                UnSelectedImagePath = "DoorLock/DoorLockPicClose.png",
@@ -366,30 +367,37 @@
            };
            btnFrameLayout.AddChidren(closeFrameLayout);
            progressFrameLayoutMatch = new FrameLayout()
            {
                Width = Application.GetRealHeight(84),//639-35
                Height = Application.GetRealHeight(446),
                X = Application.GetMinReal(51),
                BackgroundColor = ZigbeeColor.Current.XMWhite,
            };
            btnFrameLayout.AddChidren(progressFrameLayoutMatch);
            var progressFrameLayout = new FrameLayout()
            {
                Width = Application.GetRealWidth(9),//639-35
                Height = Application.GetRealHeight(446),
                X = Application.GetRealWidth(95),
                Y = Application.GetRealHeight(0),
                Width = Application.GetRealHeight(17),//639-35
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = ZigbeeColor.Current.XMVerticalSeekBar,
            };
            btnFrameLayout.AddChidren(progressFrameLayout);
            progressFrameLayoutMatch.AddChidren(progressFrameLayout);
            progressButton = new Button()
            {
                Width = Application.GetRealWidth(84),//639-35
                Height = Application.GetRealHeight(93),
                X = Application.GetRealWidth(58),
                Width = Application.GetMinReal(84),//639-35
                Height = Application.GetMinReal(93),
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(347),
                UnSelectedImagePath = "DoorLock/UnLockButton.png",
            };
            btnFrameLayout.AddChidren(progressButton);
            progressFrameLayoutMatch.AddChidren(progressButton);
            btnDoorOpenPic = new Button()
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                Width = Application.GetMinReal(81),
                Height = Application.GetMinReal(81),
                X = Application.GetRealWidth(164),
                Y = Application.GetRealHeight(6),
                UnSelectedImagePath = "DoorLock/DoorLockOpen.png",
@@ -398,8 +406,8 @@
            btnDoorClosePic = new Button()
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                Width = Application.GetMinReal(81),
                Height = Application.GetMinReal(81),
                X = Application.GetRealWidth(164),
                Y = Application.GetRealHeight(117),
                UnSelectedImagePath = "DoorLock/DoorLockClose.png",
@@ -410,8 +418,8 @@
            //电量
            btnPower = new Button()
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                Width = Application.GetMinReal(81),
                Height = Application.GetMinReal(81),
                X = Application.GetRealWidth(253),
                Y = Application.GetRealHeight(994),
                UnSelectedImagePath = "DoorLock/PowerOffline.png",
@@ -429,8 +437,8 @@
            midTopFrameLayout.AddChidren(btnVolumeFrameLayout);
            btnVolume = new Button()
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                Width = Application.GetMinReal(81),
                Height = Application.GetMinReal(81),
                X = Application.GetRealWidth(40),
                Y = Application.GetRealHeight(40),
                UnSelectedImagePath = "DoorLock/VolumeIcon.png",
@@ -449,8 +457,8 @@
            midTopFrameLayout.AddChidren(btnNormallyOpenFrameLayout);
            btnNormallyOpen = new Button()
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                Width = Application.GetMinReal(81),
                Height = Application.GetMinReal(81),
                X = Application.GetRealWidth(40),
                Y = Application.GetRealHeight(40),
                UnSelectedImagePath = "DoorLock/NormallyOpen.png",
@@ -482,8 +490,8 @@
            #region 当前房间
            var btnCurrentRoomPic = new Button()
            {
                Width = Application.GetRealWidth(81),
                Height = Application.GetRealHeight(81),
                Width = Application.GetMinReal(81),
                Height = Application.GetMinReal(81),
                X = Application.GetRealWidth(58),
                Y = Application.GetRealHeight(29),
                UnSelectedImagePath = "DoorLock/RoomPic.png",
@@ -536,14 +544,14 @@
            };
            flMain.AddChidren(progressBackground);
            var progressValue = (currentVolume * (Convert.ToInt32(((float)100 / 15) * 100))) / 100;
            //var progressValue = (currentVolume * (Convert.ToInt32(((float)100 / 15) * 100))) / 100;
            progressText = new Button()
            {
                Height = Application.GetRealHeight(58),
                Y = Application.GetRealHeight(89),
                TextColor = ZigbeeColor.Current.XMGray2,
                TextAlignment = TextAlignment.Center,
                Text = progressValue.ToString() + "%",
                Text = currentVolume.ToString() + "%",
            };
            diyImageVerticalSeekBar = new DiyImageVerticalSeekBar()
@@ -559,27 +567,14 @@
                ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                ProgressTextSize = 12,//显示百分比字体大小 
                SeekBarViewHeight = Application.GetRealHeight(17),//进度条的宽度
                Progress = progressValue,
                Progress = currentVolume,
            };
            progressBackground.AddChidren(progressText);
            progressBackground.AddChidren(diyImageVerticalSeekBar);
            diyImageVerticalSeekBar.OnProgressChangedEvent += (sender, e) =>
            {
                int curVolume = -1;
                if (e == 0)
                {
                    curVolume = 0;
                }
                else if (e == 100)
                {
                    curVolume = 14;
                }
                else
                {
                    int comandValue = e;
                    int comandValueTemp = (comandValue * 100) / (Convert.ToInt32(((float)100 / 15) * 100));
                    curVolume = comandValueTemp;
                }
                curVolume = e;
                currentVolume = curVolume;
                progressText.Text = e.ToString() + "%";
            };
@@ -690,12 +685,18 @@
                            {
                                tempRes = false;
                            }
                            NormallyOpenModeValue(tempRes);
                            HaveLogicNormallyOpenMode = await Shared.Phone.Device.Logic.SkipView.Exist();
                            Application.RunOnMainThread(() =>
                            DoorLockCommonInfo.NormallyOpenModeValue(doorLock, tempRes);
                            Application.RunOnMainThread(async () =>
                            {
                                UpdateNomallyOpenStatus();
                                var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(2);
                                if (resTemp == 1)
                                {
                                    HaveLogicNormallyOpenMode = true;
                                }
                                else if (resTemp == 0)
                                {
                                    HaveLogicNormallyOpenMode = false;
                                }
                            });
                        }
                    }
@@ -758,6 +759,7 @@
                {
                    Application.RunOnMainThread(() =>
                    {
                        UpdateNomallyOpenStatus();
                        CommonPage.Loading.Hide();
                    });
                }
@@ -786,10 +788,14 @@
            //设置
            EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) =>
            {
                var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
                //打开其他界面时前移除【暂时不移除】
                //RemoveFromParent();
                var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock);
                Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting);
                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                functionSetting.Show();
                functionSetting.devicNameAction += (deviceRename) =>
                {
                    if (!string.IsNullOrEmpty(deviceRename))
@@ -870,6 +876,10 @@
            };
            openFrameLayout.MouseUpEventHandler += hander1;
            btnDoorOpenPic.MouseUpEventHandler += hander1;
            if (progressButton.Y == Application.GetRealHeight(10))
            {
                progressFrameLayoutMatch.MouseUpEventHandler += hander1;
            }
            //关锁事件
            EventHandler<MouseEventArgs> hander2 = (sender, e) =>
@@ -910,7 +920,6 @@
            EventHandler<MouseEventArgs> handerNormallyOpen = (sender, e) =>
            {
                NomallyOpenDialog();
            };
            btnNormallyOpenFrameLayout.MouseUpEventHandler += handerNormallyOpen;
            btnNormallyOpen.MouseUpEventHandler += handerNormallyOpen;
@@ -932,15 +941,15 @@
            {
                btnPower.UnSelectedImagePath = "DoorLock/Power40.png";
            }
            else if (currentPower <= 60 && currentPower > 40 || currentPower == 60)
            else if (currentPower <= 60 && currentPower > 40)
            {
                btnPower.UnSelectedImagePath = "DoorLock/Power60.png";
            }
            else if (currentPower <= 80 && currentPower >= 60)
            else if (currentPower <= 80 && currentPower > 60)
            {
                btnPower.UnSelectedImagePath = "DoorLock/Power80.png";
            }
            else if (currentPower <= 100 && currentPower >= 80)
            else if (currentPower <= 100 && currentPower > 80)
            {
                btnPower.UnSelectedImagePath = "DoorLock/Power100.png";
            }
@@ -1026,33 +1035,46 @@
        }
        #endregion
        #region 常开模式
        /// <summary>
        /// 门锁常开模式值
        /// </summary>
        public void NormallyOpenModeValue(bool value)
        {
            string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
            if (doorLock.IsDoorLockNormallyMode.ContainsKey(key))
            {
                doorLock.IsDoorLockNormallyMode[key] = value;
            }
            else
            {
                doorLock.IsDoorLockNormallyMode.Add(key, value);
            }
        }
        #region 常开模式
        /// <summary>
        /// 常开模式处理
        /// </summary>
        private async void NomallyOpenDialog()
        {
            #region 后续版本
            //if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            //{
            //    this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
            //    return;
            //}
            //if (!UserCenterResourse.AccountOption.DoorUnLockByRemote)
            //{
            //    SystemSecondAuthentication();
            //    return;
            //}
            //action = () =>
            //{
            //    //系统密码支持操作门锁后,调用温居城的界面【常开自动化】
            //    var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock);
            //    Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting);
            //    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
            //    functionSetting.Show();
            //    functionSetting.aaaAction = () =>
            //   {
            //       UpdateNomallyOpenStatus();
            //   };
            //};
            //HdlCheckLogic.Current.CheckSecondarySecurity(action);
            #endregion
            #region 暂时版本 (最终去掉)
            if (!btnNormallyOpen.IsSelected)
            {
                if (UserCenterResourse.UserInfo.AuthorityNo != 1)
                {
                    this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess));
                    this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
                    return;
                }
@@ -1064,6 +1086,12 @@
                action = () =>
                {
                    //系统密码支持操作门锁后,调用问温居城的界面【常开自动化】
                    //Action nomallyOpenModeStartAction = () =>
                    //{
                    //    UpdateNomallyOpenStatus();
                    //};
                    string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n");
                    var confirm = Language.StringByID(R.MyInternationalizationString.Confrim);
                    var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm);
@@ -1087,31 +1115,23 @@
                        }
                        else
                        {
                            //添加App开启常开模式的历史记录
                            HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9001, string.Empty);
                            //每次重新设置常开,默认时间都是12小时
                            DoorLockCommonInfo.NormallyOpenModeInvalidTime = 12;
                            NormallyOpenModeValue(true);
                            UpdateNomallyOpenStatus();
                            CommonPage.Loading.Hide();
                            DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true);
                            Application.RunOnMainThread(() =>
                            {
                                UpdateNomallyOpenStatus();
                                CommonPage.Loading.Hide();
                            });
                            //常开模式开启提示
                            string msgNomallyModeIsTurnOn = Language.StringByID(R.MyInternationalizationString.NomallyModeIsTurnOn);
                            var doorLockInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockInValidSetting);
                            var alertNomallyModeIsTurnOn = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.DoorLockLogic, msgNomallyModeIsTurnOn, doorLockInValidSetting);
                            alertNomallyModeIsTurnOn.Show();
                            //点击自动化
                            alertNomallyModeIsTurnOn.LogicClickEvent += () =>
                            {
                                //逻辑调用前记得移除
                                ZbGateway.StatusList.Remove(this);
                                Shared.Phone.Device.Logic.SkipView.SkipAddLogic(2, doorLock);
                            };
                            alertNomallyModeIsTurnOn.InvalidClickEvent += async () =>
                            {
                                NomallyOpenModeInvalidTimeDialog();
                            };
                            AlreadyOpenNormallyMode();
                        }
                    };
                };
                HdlCheckLogic.Current.CheckSecondarySecurity(action);
            }
@@ -1119,6 +1139,8 @@
            {
                NomallyOpenModeInvalidDialog();
            }
            #endregion
        }
        /// <summary>
@@ -1128,6 +1150,7 @@
        {
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            {
                this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
                return;
            }
            string msg = Language.StringByID(R.MyInternationalizationString.NomallyModeIsCanceled).Replace("{0}", "\r\n");
@@ -1139,67 +1162,136 @@
                alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.CancelNomallyOpenModeWithLogic, msg, confirm);
            }
            alert.Show();
            alert.MsgControlClickEvent += async () =>
            {
                if (IsFromReport)
                {
                    //取消常开
                    NormallyOpenModeValue(false);
                    UpdateNomallyOpenStatus();
                    //上报“常开模式”已被取消,app默认了“常开模式”被取消
                    DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false);
                    Application.RunOnMainThread(() =>
                    {
                        UpdateNomallyOpenStatus();
                    });
                    //删除已经失效的“常开模式”的逻辑
                    if (HaveLogicNormallyOpenMode)
                    {
                        var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3);
                        //if (resTemp == 3)
                        //{
                        //    string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed);
                        //    this.ShowTipMsg(msg0);
                        //}
                    }
                }
                else
                {
                    //保持常开
                    NormallyOpenModeValue(true);
                    UpdateNomallyOpenStatus();
                    //app默认“常开模式”还是开启
                    DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true);
                    Application.RunOnMainThread(() =>
                    {
                        UpdateNomallyOpenStatus();
                    });
                }
            };
            alert.CancelClickEvent += async () =>
            {
                //保持常开
                if (IsFromReport)
                {
                    //上报“常开模式”已被取消
                    Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
                    //先删除已失效的“常开模式”的逻辑
                    if (HaveLogicNormallyOpenMode)
                    {
                        var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3);
                        //if (resTemp == 3)
                        //{
                        //    string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed2);
                        //    this.ShowTipMsg(msg0);
                        //    return;
                        //}
                    }
                    //app重新开启“常开模式”
                    var result = await doorLock.SetNormallyOpenModeFuncAsync(true);
                    if (result == null || result.defaultControlResponseData == null)
                    {
                        string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime);
                        this.ShowTipMsg(msg0);
                        NormallyOpenModeValue(false);
                        UpdateNomallyOpenStatus();
                        Application.RunOnMainThread(() =>
                        {
                            string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime);
                            this.ShowTipMsg(msg0);
                            DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false);
                            UpdateNomallyOpenStatus();
                        });
                        return;
                    }
                    if (result.defaultControlResponseData.status != 0)
                    {
                        string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed);
                        this.ShowTipMsg(msg1);
                        NormallyOpenModeValue(false);
                        UpdateNomallyOpenStatus();
                        DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false);
                        Application.RunOnMainThread(() =>
                        {
                            UpdateNomallyOpenStatus();
                        });
                        return;
                    }
                    else
                    {
                        NormallyOpenModeValue(true);
                        UpdateNomallyOpenStatus();
                        //保持“常开成功”
                        DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true);
                        Application.RunOnMainThread(() =>
                        {
                            UpdateNomallyOpenStatus();
                        });
                        //创建常开模式的特殊逻辑
                        var resu = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock);
                        //if (!resu)
                        //{
                        //    string msg0 = Language.StringByID(R.MyInternationalizationString.AddLogicNormallyModeFailed);
                        //    this.ShowTipMsg(msg0);
                        //}
                        CommonPage.Loading.Hide();
                    }
                }
                else
                {
                    NormallyOpenModeValue(true);
                    UpdateNomallyOpenStatus();
                    //app操作不取消“常开模式”
                    DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true);
                    Application.RunOnMainThread(() =>
                    {
                        UpdateNomallyOpenStatus();
                    });
                }
            };
            alert.ConfirmClickEvent += async () =>
            {
                //确认取消常开
                if (IsFromReport)
                {
                    NormallyOpenModeValue(false);
                    UpdateNomallyOpenStatus();
                    //上报门锁“常开模式”已经取消,现在app确认“常开模式”取消
                    DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false);
                    Application.RunOnMainThread(() =>
                    {
                        UpdateNomallyOpenStatus();
                    });
                    //删除已经失效的“常开模式”的逻辑
                    if (HaveLogicNormallyOpenMode)
                    {
                        var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3);
                        //if (resTemp == 3)
                        //{
                        //    string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed);
                        //    this.ShowTipMsg(msg0);
                        //}
                    }
                }
                else
                {
                    //app操作取消“常开模式”
                    Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
                    var result = await doorLock.SetNormallyOpenModeFuncAsync(false);
                    if (result == null || result.defaultControlResponseData == null)
@@ -1215,18 +1307,75 @@
                        return;
                    }
                    else
                    {
                        NormallyOpenModeValue(false);
                        UpdateNomallyOpenStatus();
                    {
                        //添加App开启常开模式的历史记录
                        HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9002, string.Empty);
                        //app确认取消“常开模式”成功
                        DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false);
                        Application.RunOnMainThread(() =>
                        {
                            UpdateNomallyOpenStatus();
                        });
                        //删除设置常开模式创建的逻辑
                        if (HaveLogicNormallyOpenMode)
                        {
                            var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3);
                            //因为目前机制问题,逻辑经常失败,所以不提示,后期机制要改,重新做一个这个界面
                            //if (resTemp == 3)
                            //{
                            //    string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed);
                            //    this.ShowTipMsg(msg0);
                            //}
                            //else if (resTemp == 2)
                            //{
                            //    string msg2 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess);
                            //    this.ShowTipMsg(msg2);
                            //}
                        }
                        string msg2 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess);
                        this.ShowTipMsg(msg2);
                        Shared.Phone.Device.Logic.SkipView.LockCloseLogic(doorLock);
                    }
                }
            };
        }
        ///// <summary>
        /// <summary>
        /// 已经开启常开模式提示
        /// </summary>
        public void AlreadyOpenNormallyMode()
        {
            //常开模式开启提示
            string msgNomallyModeIsTurnOn = Language.StringByID(R.MyInternationalizationString.NomallyModeIsTurnOn);
            var doorLockInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockInValidSetting);
            var alertNomallyModeIsTurnOn = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.DoorLockLogic, msgNomallyModeIsTurnOn, doorLockInValidSetting);
            alertNomallyModeIsTurnOn.Show();
            alertNomallyModeIsTurnOn.MsgControlClickEvent += async () =>
            {
                //默认创建常开模式的特殊逻辑
                var res = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock);
                //if (!res)
                //{
                //string msg0 = Language.StringByID(R.MyInternationalizationString.AddLogicNormallyModeFailed);
                // this.ShowTipMsg(msg0);
                //return;
                //}
            };
            //点击自动化
            alertNomallyModeIsTurnOn.LogicClickEvent += () =>
            {
                //逻辑调用前记得移除
                ZbGateway.StatusList.Remove(this);
                //调用逻辑界面
                Shared.Phone.Device.Logic.SkipView.SkipAddLogic(2, doorLock);
            };
            alertNomallyModeIsTurnOn.InvalidClickEvent += async () =>
            {
                NomallyOpenModeInvalidTimeDialog();
            };
        }
        /// <summary>
        /// 常开模式失效时间处理
        /// </summary>
        private void NomallyOpenModeInvalidTimeDialog()
@@ -1237,26 +1386,25 @@
            var alertTimeInValidSetting = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting, timeConfrim);
            alertTimeInValidSetting.Show();
            alertTimeInValidSetting.InvalidTimeAction += (obj) =>
            {
                Regex rg = new Regex("^[0-9]+$");
                if (!rg.IsMatch(obj))
                {
                    //必须是数字
                    string msg0 = Language.StringByID(R.MyInternationalizationString.NormallyOpenModeInvalidTimeTip);
                    this.ShowTipMsg(msg0);
                    string msgTimeInValidSetting2 = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime);
                    var timeConfrim2 = Language.StringByID(R.MyInternationalizationString.Confrim);
                    var alertTimeInValidSetting2 = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting2, timeConfrim2);
                    alertTimeInValidSetting2.Show();
                    return;
                }
                var temp = int.Parse(obj);
                DoorLockCommonInfo.NormallyOpenModeInvalidTime = temp;
                Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock);
            };
            alertTimeInValidSetting.InvalidTimeAction += async (obj) =>
             {
                 //常开模式失效时间设置成功
                 var temp = int.Parse(obj);
                 DoorLockCommonInfo.NormallyOpenModeInvalidTime = temp;
                 //默认创建常开模式的特殊逻辑
                 var res = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock);
                 if (!res)
                 {
                     //默认创建常开模式失败
                     string msg0 = Language.StringByID(R.MyInternationalizationString.AddLogicNormallyModeFailed);
                     var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, msg0, Language.StringByID(R.MyInternationalizationString.confrim));
                     alert.Show();
                     //二次加载弹窗 常开模式开启提示
                     NomallyOpenModeInvalidTimeDialog();
                 }
             };
        }
        /// <summary>
        /// 常开模式状态更新
        /// </summary>
@@ -1267,7 +1415,11 @@
                btnNormallyOpenFrameLayout.Width = Application.GetRealWidth(0);
                return;
            }
            string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
            string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
            if (!doorLock.IsDoorLockNormallyMode.ContainsKey(key))
            {
                return;
            }
            if (doorLock.IsDoorLockNormallyMode[key] == true)
            {
                btnNormallyOpen.IsSelected = true;
@@ -1305,7 +1457,7 @@
                    var result1 = await DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid);
                    if (result1 == true)
                    {
                        RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle);
                        RemoteUnlockRequest(currentRoom, deviceUI, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle);
                        devicNameSecAction += (deviceRename) =>
                        {
                            if (!string.IsNullOrEmpty(deviceRename))
@@ -1335,7 +1487,7 @@
            }
            else
            {
                RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle);
                RemoteUnlockRequest(currentRoom, deviceUI, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle);
                devicNameSecAction += (deviceRename) =>
                {
                    if (!string.IsNullOrEmpty(deviceRename))