黄学彪
2020-05-07 e2cd94abacc0101af8d0db7fed3a785c1a045b5d
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -1025,49 +1025,99 @@
        private async void NomallyOpenDialog()
        {
            #region 后续版本
            //if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            //{
            //    this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
            //    return;
            //}
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            {
                this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate));
                return;
            }
            //if (!UserCenterResourse.AccountOption.DoorUnLockByRemote)
            //{
            //    SystemSecondAuthentication();
            //    return;
            //}
            if (!UserCenterResourse.AccountOption.DoorUnLockByRemote)
            {
                SystemSecondAuthentication();
                return;
            }
            action = () =>
            {
                //系统密码支持操作门锁后,调用温居城的界面【常开自动化】
                if (doorLock == null)
                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.OnlyMasterOperate));
                    return;
                }
                ///备注:WJC的
                Shared.Phone.Device.Logic.Send.CurrentDoorLock = doorLock;
                ///进来刷新一次设备列表;
                Common.Logic.LogicDviceList.Clear();
                if (Common.Logic.LogicDviceList.Count == 0)
                if (!UserCenterResourse.AccountOption.DoorUnLockByRemote)
                {
                    Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
                    SystemSecondAuthentication();
                    return;
                }
                var addLogicPage = new Shared.Phone.Device.Logic.SoneLogicList();
                UserView.HomePage.Instance.AddChidren(addLogicPage);
                UserView.HomePage.Instance.PageIndex += 1;
                addLogicPage.Show();
                addLogicPage.action += (w) =>
                action = () =>
                {
                    doorLock.IsDoorLockNormallyMode = w;
                    ///留给徐梅用的
                    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);
                    alert.Show();
                    alert.ConfirmClickEvent += async () =>
                    {
                        Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
                        var result = await doorLock.SetNormallyOpenModeFuncAsync(true);
                        if (result == null || result.defaultControlResponseData == null)
                        {
                            string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime);
                            this.ShowTipMsg(msg0);
                            return;
                        }
                        if (result.defaultControlResponseData.status != 0)
                        {
                            string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed);
                            this.ShowTipMsg(msg1);
                            return;
                        }
                        else
                        {
                            //添加App开启常开模式的历史记录
                            HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9001, string.Empty);
                            //每次重新设置常开,默认时间都是12小时
                            DoorLockCommonInfo.NormallyOpenModeInvalidTime = 12;
                            DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true);
                            Application.RunOnMainThread(() =>
                            {
                                UpdateNomallyOpenStatus();
                                CommonPage.Loading.Hide();
                            });
                            //常开模式开启提示
                            AlreadyOpenNormallyMode();
                        }
                    };
                };
            };
            //HdlCheckLogic.Current.CheckSecondarySecurity(action);
                HdlCheckLogic.Current.CheckSecondarySecurity(action);
            }
            else
            {
                NomallyOpenModeInvalidDialog();
            }
            #endregion
        }
        /// <summary>