From 8b9ce384b26c414db32f98e94e088f5334869c2d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 13 十一月 2019 15:36:28 +0800
Subject: [PATCH] 全部合并了代码,安卓和 IOS 都测试通过了

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs |  241 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 176 insertions(+), 65 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
index 7e1b6b2..ecffb1c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
@@ -20,6 +20,22 @@
 
         #region 鈼� 鍙橀噺鐢虫槑__________________________
         ZigBee.Device.DoorLock doorLock;
+        /// <summary>
+        /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧
+        /// </summary>
+        private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>();
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勮澶�
+        /// </summary>
+        private CommonDevice nowSelectDevice = null;
+        /// <summary>
+        /// 璁惧澶囨敞鐨勬帶浠�
+        /// </summary>
+        private FrameCaptionInputControl btnDeviceName = null;
+        /// <summary>
+        /// 璁惧鐨勬煇涓�鍥炶矾
+        /// </summary>
+        private CommonDevice deviceObj = null;
         #endregion
 
         /// <summary>
@@ -27,7 +43,7 @@
         /// </summary>
         public void Show()
         {
-            this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.FunctionSetting));
+            this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.DoorLockFunctionSetting));
 
             EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
             {
@@ -78,7 +94,7 @@
 
             var bottomFrameLayout2 = new FrameLayout()
             {
-                Height = Application.GetRealHeight(1319),
+                Height = Application.GetRealHeight(1054),
                 Y = Application.GetRealHeight(418),
             };
             this.midFrameLayout.AddChidren(bottomFrameLayout2);
@@ -91,11 +107,11 @@
                 Text = Language.StringByID(R.MyInternationalizationString.InformationEdit),
                 TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextSize = 12,
+                TextSize = 15,
             };
             bottomFrameLayout2.AddChidren(informationEdit);
 
-            for (int i = 0; i < 7; i++)
+            for (int i = 0; i < 6; i++)
             {
                 var bottomRowLayout = new FrameLayout()
                 {
@@ -108,9 +124,9 @@
                     Width = Application.GetRealWidth(233),
                     Height = Application.GetRealHeight(58),
                     X = Application.GetRealWidth(58),
-                    TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+                    TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
                     TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = 12,
+                    TextSize = 14,
                 };
                 bottomRowLayout.AddChidren(btnName);
 
@@ -133,7 +149,7 @@
                 var btnLine = new FrameLayout()
                 {
                     Width = Application.GetRealWidth(965),
-                    Height = Application.GetRealHeight(2),
+                    Height = 1,
                     X = Application.GetRealWidth(58),
                     BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
                     Visible = false,
@@ -208,7 +224,7 @@
                     btnNext.SelectedImagePath = "DoorLock/SwitchOn.png";
                     btnLine.Visible = true;
                     btnLine.Y = Application.GetRealHeight(853);
-                    if (ZigBee.Device.DoorLock.RemoteUnlockPassword == "")
+                    if (doorLock.RemoteUnlockPassword == "")
                     {
                         btnNext.IsSelected = false;
                     }
@@ -223,73 +239,168 @@
                     btnName.Text = Language.StringByID(R.MyInternationalizationString.DoorLockTime);
                     btnNextFrameLayout.Y = btnName.Y;
                     btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
-                    btnLine.Visible = true;
+                    btnLine.Visible = false;
                     btnLine.Y = Application.GetRealHeight(992);
                 }
-                else if (i == 6)
-                {
-                    bottomRowLayout.Y = Application.GetRealHeight(999 + 35);
-                    btnName.Text = Language.StringByID(R.MyInternationalizationString.DoorLockShare);
-                    btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
-                    btnLine.Visible = true;
-                    btnLine.Y = Application.GetRealHeight(1131);
-                }
+                //else if (i == 6)
+                //{
+                //    bottomRowLayout.Y = Application.GetRealHeight(999 + 35);
+                //    btnName.Text = Language.StringByID(R.MyInternationalizationString.DoorLockShare);
+                //    btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
+                //    btnLine.Visible = true;
+                //    btnLine.Y = Application.GetRealHeight(1131);
+                //}
                 int currentIndex = i;
-                EventHandler<MouseEventArgs> eHandler = (sender, e) =>
-                {
-                    if (currentIndex == 1)
-                    {
-                        //鑾峰彇璁惧鎵�灞炴埧闂�
-                        var aa = Common.Room.CurrentRoom.GetRoomByDevice(doorLock);
-                        //鑾峰彇璁惧鎵�鍦ㄦゼ灞�
-                        var bb = aa.FloorId;
-                        //鑾峰彇璁惧鎵�鍦ㄦゼ灞�
-                        var cc = aa.FloorId;
-                        //鑾峰彇妤煎眰鐨勫悕瀛�
-                        var dd = Common.Config.Instance.Home.GetFloorNameById(cc);
-                        //if (Common.Config.Instance.Home.FloorDics.Count == 0)//杩欎釜鏄棤妤煎眰妯″紡
+                EventHandler<MouseEventArgs> eHandler = async (sender, e) =>
+                 {
+                     if (currentIndex == 1)
+                     {
+                         //鑾峰彇璁惧鎵�灞炴埧闂�
+                         var aa = Common.Room.CurrentRoom.GetRoomByDevice(doorLock);
+                         //鑾峰彇璁惧鎵�鍦ㄦゼ灞�
+                         var bb = aa.FloorId;
+                         //鑾峰彇璁惧鎵�鍦ㄦゼ灞�
+                         var cc = aa.FloorId;
+                         //鑾峰彇妤煎眰鐨勫悕瀛�
+                         var dd = Common.Config.Instance.Home.GetFloorNameById(cc);
+                         //if (Common.Config.Instance.Home.FloorDics.Count == 0)//杩欎釜鏄棤妤煎眰妯″紡
 
-                        var listCheck = new List<string>();
-                    }
-                    else if (currentIndex == 3)
-                    {
-                        var temporaryPassword = new Shared.Phone.UserCenter.DoorLock.TemporaryPassword(doorLock);
-                        Shared.Phone.UserView.HomePage.Instance.AddChidren(temporaryPassword);
-                        Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                        temporaryPassword.Show();
-                    }
-                    else if (currentIndex == 4)
-                    {
-                        btnNext.IsSelected = !btnNext.IsSelected;
-                        if (btnNext.IsSelected)
-                        {
-                            if (ZigBee.Device.DoorLock.RemoteUnlockPassword == "")
-                            {
-                                RemotePasswordDialog(doorLock, btnNext);
-                            }
-                        }
-                        else
-                        {
-                            ZigBee.Device.DoorLock.RemoteUnlockPassword = "";
-                        }
-                    }
-                    else if (currentIndex == 5)
-                    {
-                        var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime");
-                        Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage);
-                        Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                        tempPage.Show();
-                    }
-                    else if (currentIndex == 6)
-                    {
-                    }
-                };
+                         var listCheck = new List<string>();
+                     }
+                     else if (currentIndex == 3)
+                     {
+                         var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                         if (result == false)
+                         {
+                             var temporaryPassword = new Shared.Phone.UserCenter.DoorLock.TemporaryPassword(doorLock);
+                             Shared.Phone.UserView.HomePage.Instance.AddChidren(temporaryPassword);
+                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                             temporaryPassword.Show();
+                         }
+                         else
+                         {
+                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                         }
+
+                     }
+                     else if (currentIndex == 4)
+                     {
+                         if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                         {
+                             var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                             if (result == false)
+                             {
+                                 var result1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                                 if (result1 == true)
+                                 {
+                                     btnNext.IsSelected = !btnNext.IsSelected;
+                                     if (btnNext.IsSelected)
+                                     {
+                                         if (doorLock.RemoteUnlockPassword == "")
+                                         {
+                                             RemotePasswordDialog(doorLock, btnNext);
+                                         }
+                                     }
+                                     else
+                                     {
+                                         doorLock.RemoteUnlockPassword = "";
+                                     }
+                                 }
+                                 else
+                                 {
+                                     new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                                 }
+                             }
+                             else
+                             {
+                                 new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                             }
+                         }
+                         else
+                         {
+                             btnNext.IsSelected = !btnNext.IsSelected;
+                             if (btnNext.IsSelected)
+                             {
+                                 if (doorLock.RemoteUnlockPassword == "")
+                                 {
+                                     RemotePasswordDialog(doorLock, btnNext);
+                                 }
+                             }
+                             else
+                             {
+                                 doorLock.RemoteUnlockPassword = "";
+                             }
+                         }
+                     }
+                     else if (currentIndex == 5)
+                     {
+                         var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                         if (result == false)
+                         {
+                             var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime");
+                             Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage);
+                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                             tempPage.Show();
+                         }
+                         else
+                         {
+                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                         }
+                     }
+                 };
                 bottomRowLayout.MouseDownEventHandler += eHandler;
                 btnNext.MouseDownEventHandler += eHandler;
                 btnName.MouseDownEventHandler += eHandler;
                 btnNextFrameLayout.MouseDownEventHandler += eHandler;
                 #endregion
             }
+
+            //淇濆瓨
+            //var btnFinifh = new Button()
+            //{
+            //    Width = Application.GetRealWidth(907),
+            //    Height = Application.GetRealHeight(127),
+            //    Y = Application.GetRealHeight(1472),
+            //    Gravity = Gravity.CenterHorizontal,
+            //    Radius = (uint)Application.GetRealHeight(127) / 2,
+            //    TextID = R.MyInternationalizationString.Save,
+            //    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+            //    TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
+            //    TextSize = 16,
+            //};
+            //this.midFrameLayout.AddChidren(btnFinifh);
+            //btnFinish.MouseUpEventHandler += async (sender, e) =>
+            //{
+            //    //璁板綍璧峰綋鍓嶆鍦ㄦ搷浣滅殑鍥炶矾鍚嶅瓧
+            //    dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
+            //    //寮�鍚繘搴︽潯
+            //    this.ShowProgressBar();
+            //    foreach (var epoint in dicDeviceSaveName.Keys)
+            //    {
+            //        var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint);
+            //        if (device == null || dicDeviceSaveName[epoint] == string.Empty)
+            //        {
+            //            //涓嶈兘鍏佽绌虹櫧鍚嶅瓧
+            //            continue;
+            //        }
+            //        string newName = dicDeviceSaveName[epoint];
+            //        string oldName = Common.LocalDevice.Current.GetDeviceEpointName(device);
+            //        if (oldName != newName)
+            //        {
+            //            //璁惧鍚嶇О淇敼
+            //            var result = await Common.LocalDevice.Current.ReName(device, newName);
+            //            if (result == false)
+            //            {
+            //                //鍏抽棴
+            //                this.CloseProgressBar();
+            //                return;
+            //            }
+            //        }
+            //    }
+            //    this.CloseProgressBar();
+            //    //鍏抽棴鑷韩
+            //    this.CloseForm();
+            //};
         }
 
         #region 鈼� 鎺ュ彛瀹炵幇__________________________

--
Gitblit v1.8.0