From 309f878169da2f0482dd40b81a84b606ed29cedf Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 07 五月 2020 11:25:05 +0800
Subject: [PATCH] 上传

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs |   93 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 79 insertions(+), 14 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
index 37601a4..93c7a9f 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -1025,17 +1025,17 @@
         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 = () =>
             {
@@ -1062,12 +1062,77 @@
                     doorLock.IsDoorLockNormallyMode = w;
                     ///鐣欑粰寰愭鐢ㄧ殑
                     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;
+                }
+
+                if (!UserCenterResourse.AccountOption.DoorUnLockByRemote)
+                {
+                    SystemSecondAuthentication();
+                    return;
+                }
+
+                action = () =>
+                {
+                    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>

--
Gitblit v1.8.0