From 16604a593202f2f87adf71abd57d036fe7da3b52 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 18 十一月 2019 10:39:42 +0800
Subject: [PATCH] 同步了全部的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs |  142 ++++++++++++++++++++++++++---------------------
 1 files changed, 79 insertions(+), 63 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
index ecffb1c..cef7875 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
@@ -36,6 +36,9 @@
         /// 璁惧鐨勬煇涓�鍥炶矾
         /// </summary>
         private CommonDevice deviceObj = null;
+        Action action;
+        string modifyDeviceName = "";
+        bool IsModifyName = true;
         #endregion
 
         /// <summary>
@@ -94,7 +97,7 @@
 
             var bottomFrameLayout2 = new FrameLayout()
             {
-                Height = Application.GetRealHeight(1054),
+                Height = Application.GetRealHeight(1000),
                 Y = Application.GetRealHeight(418),
             };
             this.midFrameLayout.AddChidren(bottomFrameLayout2);
@@ -159,14 +162,55 @@
                 if (i == 0)
                 {
                     bottomRowLayout.Y = Application.GetRealHeight(220);
-                    btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceRemarkXm) + ":";
+                    btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceRemarkXm);
                     btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58);
                     btnNextFrameLayout.X = Application.GetRealWidth(233);
-                    btnNext.TextAlignment = TextAlignment.CenterLeft;
-                    btnNext.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
                     btnNext.Text = doorLock.DeviceName;
+                    var btnDeviceNameEditText = new Button()
+                    {
+                        Width = Application.GetRealWidth(789 - 58),
+                        Height = Application.GetRealHeight(58),
+                        X = Application.GetRealWidth(46),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                        Text = doorLock.DeviceName
+                    };
+                    btnNextFrameLayout.AddChidren(btnDeviceNameEditText);
+                    //btnDeviceNameEditText.TextChangeEventHandler += (sender, e) =>
+                    //{
+                    //    modifyDeviceName = btnDeviceNameEditText.Text;
+                    //};
+                    //Action<Shared.View> actionEdit = async (obj) =>
+                    // {
+                    //     try
+                    //     {
+                    //         Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
+                    //         var doorLockDeviceList = new List<CommonDevice> { };
+                    //         doorLockDeviceList.Add(doorLock);
+                    //         var result = await Common.LocalDevice.Current.ReMacName(doorLockDeviceList, btnDeviceNameEditText.Text);
+                    //         if (result)
+                    //         {
+                    //             IsModifyName = false;
+                    //         }
+                    //         else
+                    //         {
+                    //             IsModifyName = true;
+                    //         }
+                    //     }
+                    //     catch { }
+                    //     finally
+                    //     {
+                    //         Application.RunOnMainThread(() =>
+                    //         {
+                    //             CommonPage.Loading.Hide();
+                    //         });
+                    //     }
+                    // };
+                    // btnDeviceNameEditText.EditorEnterAction += actionEdit;
+
                     btnLine.Visible = true;
                     btnLine.Y = Application.GetRealHeight(303);
+
                 }
                 else if (i == 1)
                 {
@@ -242,46 +286,26 @@
                     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);
-                //}
                 int currentIndex = i;
                 EventHandler<MouseEventArgs> eHandler = async (sender, e) =>
                  {
-                     if (currentIndex == 1)
+                     if (currentIndex == 3)
                      {
-                         //鑾峰彇璁惧鎵�灞炴埧闂�
-                         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 result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
-                         if (result == false)
+                         if (!UserCenterResourse.Option.DoorUnLockByRemote)
                          {
-                             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();
+                             SecurityRequest(doorLock, action);
                          }
                          else
                          {
-                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                             action = async () =>
+                             {
+                                 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();
+                             };
+                             HdlCheckLogic.Current.CheckSecondarySecurity(action);
                          }
-
                      }
                      else if (currentIndex == 4)
                      {
@@ -308,12 +332,12 @@
                                  }
                                  else
                                  {
-                                     new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                                     new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                                  }
                              }
                              else
                              {
-                                 new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                                 new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                              }
                          }
                          else
@@ -344,7 +368,7 @@
                          }
                          else
                          {
-                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                          }
                      }
                  };
@@ -369,37 +393,29 @@
             //    TextSize = 16,
             //};
             //this.midFrameLayout.AddChidren(btnFinifh);
-            //btnFinish.MouseUpEventHandler += async (sender, e) =>
+            //btnFinish.MouseUpEventHandler += (sender, e) =>
             //{
-            //    //璁板綍璧峰綋鍓嶆鍦ㄦ搷浣滅殑鍥炶矾鍚嶅瓧
-            //    dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim();
-            //    //寮�鍚繘搴︽潯
-            //    this.ShowProgressBar();
-            //    foreach (var epoint in dicDeviceSaveName.Keys)
+            //    System.Threading.Tasks.Task.Run(async () =>
             //    {
-            //        var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint);
-            //        if (device == null || dicDeviceSaveName[epoint] == string.Empty)
+            //        Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
+            //        try
             //        {
-            //            //涓嶈兘鍏佽绌虹櫧鍚嶅瓧
-            //            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)
+            //            if (IsModifyName)
             //            {
-            //                //鍏抽棴
-            //                this.CloseProgressBar();
-            //                return;
+            //                var doorLockDeviceList = new List<CommonDevice> { };
+            //                doorLockDeviceList.Add(doorLock);
+            //                await Common.LocalDevice.Current.ReMacName(doorLockDeviceList, modifyDeviceName);
             //            }
             //        }
-            //    }
-            //    this.CloseProgressBar();
-            //    //鍏抽棴鑷韩
-            //    this.CloseForm();
+            //        catch { }
+            //        finally
+            //        {
+            //            Application.RunOnMainThread(() =>
+            //            {
+            //                CommonPage.Loading.Hide();
+            //            });
+            //        }
+            //    });
             //};
         }
 

--
Gitblit v1.8.0