From ff3cfcf62632bf43e51a6b6098c203bf0f5cddbc Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 24 十二月 2019 19:53:29 +0800
Subject: [PATCH] 2019.12.24

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs |  184 ++++++++++++++++++++++++---------------------
 1 files changed, 97 insertions(+), 87 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
index cef7875..0fbe09b 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
@@ -37,8 +37,10 @@
         /// </summary>
         private CommonDevice deviceObj = null;
         Action action;
+        Action actionNone;
         string modifyDeviceName = "";
         bool IsModifyName = true;
+        public Action<string> devicNameAction;
         #endregion
 
         /// <summary>
@@ -62,7 +64,6 @@
 
         public void MidFrameLayoutContent()
         {
-
             var MidTopFrameLayout = new FrameLayout()
             {
                 X = Application.GetRealWidth(449),
@@ -166,47 +167,49 @@
                     btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58);
                     btnNextFrameLayout.X = Application.GetRealWidth(233);
                     btnNext.Text = doorLock.DeviceName;
-                    var btnDeviceNameEditText = new Button()
+                    var btnDeviceNameEditText = new EditText()
                     {
-                        Width = Application.GetRealWidth(789 - 58),
-                        Height = Application.GetRealHeight(58),
                         X = Application.GetRealWidth(46),
+                        Width = Application.GetRealWidth(731),
+                        Height = Application.GetRealHeight(58),
+                        TextColor = ZigbeeColor.Current.XMGray3,
+                        PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor2,
                         TextAlignment = TextAlignment.CenterLeft,
-                        TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
-                        Text = doorLock.DeviceName
+                        Text = string.IsNullOrEmpty(doorLock.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : 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;
+
+                    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);
@@ -291,21 +294,18 @@
                  {
                      if (currentIndex == 3)
                      {
-                         if (!UserCenterResourse.Option.DoorUnLockByRemote)
+                         action = async () =>
                          {
-                             SecurityRequest(doorLock, action);
-                         }
-                         else
+                             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();
+                         };
+                         actionNone = async () =>
                          {
-                             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);
-                         }
+                             Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action);
+                         };
+                         HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
                      }
                      else if (currentIndex == 4)
                      {
@@ -380,43 +380,53 @@
             }
 
             //淇濆瓨
-            //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 += (sender, e) =>
-            //{
-            //    System.Threading.Tasks.Task.Run(async () =>
-            //    {
-            //        Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
-            //        try
-            //        {
-            //            if (IsModifyName)
-            //            {
-            //                var doorLockDeviceList = new List<CommonDevice> { };
-            //                doorLockDeviceList.Add(doorLock);
-            //                await Common.LocalDevice.Current.ReMacName(doorLockDeviceList, modifyDeviceName);
-            //            }
-            //        }
-            //        catch { }
-            //        finally
-            //        {
-            //            Application.RunOnMainThread(() =>
-            //            {
-            //                CommonPage.Loading.Hide();
-            //            });
-            //        }
-            //    });
-            //};
+            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);
+            btnFinifh.MouseUpEventHandler += (sender, e) =>
+            {
+                System.Threading.Tasks.Task.Run(async () =>
+                {
+                    Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
+                    try
+                    {
+                        if (IsModifyName)
+                        {
+                            var doorLockDeviceList = new List<CommonDevice> { };
+                            doorLockDeviceList.Add(doorLock);
+                            var result = await Common.LocalDevice.Current.ReMacName(doorLockDeviceList, modifyDeviceName);
+                            if (result)
+                            {
+                                if (devicNameAction != null)
+                                {
+                                    devicNameAction(modifyDeviceName);
+                                }
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        var mess = ex.Message;
+                    }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            CommonPage.Loading.Hide();
+                        });
+                    }
+                });
+            };
         }
 
         #region 鈼� 鎺ュ彛瀹炵幇__________________________

--
Gitblit v1.8.0