From 8b4d79ca03495e522a1953e04ca17527f33c853a Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 28 十月 2019 13:22:17 +0800
Subject: [PATCH] 合并完成代码

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs |  159 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 116 insertions(+), 43 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs
index b820eb9..b6001cf 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs
@@ -31,8 +31,8 @@
         DateTime cunIVDateTime;
         #endregion
 
-        /// <summary>
-        /// UI鏄剧ず
+        /// <summary>
+        /// UI鏄剧ず
         /// </summary>
         public void Show()
         {
@@ -112,9 +112,31 @@
                 delBackgroundFrameLayout.AddChidren(btnDelText);
 
                 EventHandler<MouseEventArgs> eHandler2 = (sender2, e2) =>
-                 {
-                     ClearEventHandler(btnDelText, dialog);
-                 };
+                {
+                    var dialog1 = new Dialog { };
+                    var doorDialog = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog1, Language.StringByID(R.MyInternationalizationString.Tip));
+                    doorDialog.Show();
+                    doorDialog.dialogMidFraFrameLayout.Width = Application.GetRealWidth(415);
+                    doorDialog.dialogMidFraFrameLayout.Height = Application.GetRealHeight(58);
+                    doorDialog.dialogMidFraFrameLayout.X = Application.GetRealWidth(190);
+                    doorDialog.dialogMidFraFrameLayout.Y = Application.GetRealHeight(202);
+                    doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText);
+                    doorDialog.dialogMidText.Text = Language.StringByID(R.MyInternationalizationString.SureToDeleteTempPassword);
+                    doorDialog.dialogMidText.TextSize = 14;
+                    doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText);
+                    doorDialog.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.Confrim);
+                    doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) =>
+                    {
+                        dialog.Close();
+                        dialog1.Close();
+                    };
+                    doorDialog.dialogBtnConfirm.MouseUpEventHandler += (sender1, e1) =>
+                    {
+                        dialog.Close();
+                        dialog1.Close();
+                        ClearEventHandler(btnDelText, dialog1);
+                    };
+                };
                 delBackgroundFrameLayout.MouseDownEventHandler += eHandler2;
                 btnDelIcon2.MouseDownEventHandler += eHandler2;
                 btnDelText.MouseDownEventHandler += eHandler2;
@@ -161,6 +183,8 @@
                 Text = Language.StringByID(R.MyInternationalizationString.ClickGenerate),
                 TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
                 TextSize = 12,
+                Visible = true,
+                Enable = true,
             };
             topMidTopFrameLayout.AddChidren(topPic);
 
@@ -243,11 +267,15 @@
             {
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                 btnFinifh.Enable = true;
+                topPic.Visible = true;
+                topPic.Enable = true;
             }
             else
             {
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
                 btnFinifh.Enable = false;
+                topPic.Visible = false;
+                topPic.Enable = false;
             }
             if (string.IsNullOrEmpty(doorLock.LocalTempPassword))
             {
@@ -256,12 +284,15 @@
                 randomPassword.X = Application.GetRealWidth(215);
                 randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4;
                 Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true;
+                topPic.Visible = true;
+                topPic.Enable = true;
             }
             else
             {
                 randomPassword.Text = doorLock.LocalTempPassword;
                 temPasswordVisiable.Visible = true;
-
+                // topPic.Visible = false;
+                // topPic.Enable = false;
                 if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable)
                 {
                     randomPassword.SecureTextEntry = false;
@@ -431,6 +462,29 @@
                 btnNext.MouseDownEventHandler += hander;
             }
 
+            var modifyTempPasswordTip1 = new Button()
+            {
+                Height = Application.GetRealHeight(49),
+                Y = Application.GetRealHeight(628),
+                TextID = R.MyInternationalizationString.ModifyTempPasswordTip1,
+                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                TextSize = 12,
+                TextAlignment = TextAlignment.Center,
+            };
+            bottomFrameLayout.AddChidren(modifyTempPasswordTip1);
+
+            var modifyTempPasswordTip2 = new Button()
+            {
+                Height = Application.GetRealHeight(49),
+                Y = modifyTempPasswordTip1.Bottom,
+                Radius = (uint)Application.GetRealHeight(120) / 2,
+                TextID = R.MyInternationalizationString.ModifyTempPasswordTip2,
+                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                TextSize = 12,
+                TextAlignment = TextAlignment.Center,
+            };
+            bottomFrameLayout.AddChidren(modifyTempPasswordTip2);
+
             btnFinifh = new Button()
             {
                 Width = Application.GetRealWidth(907),
@@ -469,40 +523,40 @@
                         });
                         return;
                     }
-                    if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100)
-                    {
-                        //璇疯缃敓鏁堟椂闂达紱
-                        Application.RunOnMainThread(() =>
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip2), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
-                        });
-                        return;
-                    }
-                    if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0)
-                    {
-                        //璇疯缃敓鏁堟棩鏈燂紱
-                        Application.RunOnMainThread(() =>
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip3), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
-                        });
-                        return;
-                    }
-                    if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100)
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip4), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
-                        });
-                        return;
-                    }
-                    if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0)
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip5), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
-                        });
-                        return;
-                    }
+                    //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100)
+                    //{
+                    //    //璇疯缃敓鏁堟椂闂达紱
+                    //    Application.RunOnMainThread(() =>
+                    //    {
+                    //        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip2), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
+                    //    });
+                    //    return;
+                    //}
+                    //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0)
+                    //{
+                    //    //璇疯缃敓鏁堟棩鏈燂紱
+                    //    Application.RunOnMainThread(() =>
+                    //    {
+                    //        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip3), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
+                    //    });
+                    //    return;
+                    //}
+                    //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100)
+                    //{
+                    //    Application.RunOnMainThread(() =>
+                    //    {
+                    //        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip4), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
+                    //    });
+                    //    return;
+                    //}
+                    //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0)
+                    //{
+                    //    Application.RunOnMainThread(() =>
+                    //    {
+                    //        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip5), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
+                    //    });
+                    //    return;
+                    //}
 
                     var dNow = DateTime.Now;
                     var validDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute, dNow.Second);
@@ -554,6 +608,11 @@
                         if (doorLock.tempPasswordObject != null)
                         {
                             var addDoorLockTempPasswordData = new ZigBee.Device.DoorLock.AddDoorLockTempPasswordData();
+                            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                            {
+                                addDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                                addDoorLockTempPasswordData.IsOtherAccountCtrl = true;
+                            }
                             addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword;
                             if (doorLock.DeviceAddr != null)
                             {
@@ -572,8 +631,8 @@
                                 });
                                 return;
                             }
-                            btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;//XMUnSelect  XMBlack
-                            btnFinifh.Enable = false;
+                            //btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;//XMUnSelect  XMBlack
+                            //btnFinifh.Enable = false;
                             Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = false;
                             doorLock.LocalTempPassword = doorLock.tempPasswordObject.TempPassword;
                             TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime);
@@ -596,7 +655,10 @@
                         return;
                     }
                 }
-                catch { }
+                catch (Exception ex)
+                {
+                    var mess = ex.Message;
+                }
                 finally
                 {
                     Application.RunOnMainThread(() =>
@@ -625,6 +687,11 @@
                     if (resultData != null && resultData.defaultControlResponseData != null && resultData.defaultControlResponseData.status == 0)
                     {
                         var delDoorLockTempPasswordData = new ZigBee.Device.DoorLock.DelDoorLockTempPasswordData();
+                        if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                        {
+                            delDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                            delDoorLockTempPasswordData.IsOtherAccountCtrl = true;
+                        }
                         if (doorLock.DeviceAddr != null)
                         {
                             delDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -636,6 +703,7 @@
                             doorLock.LocalTempPassword = "";
                             TimeDateData(DateTime.Now, DateTime.Now, true);
                             Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = false;
+                            Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true;
                         }
                         else
                         {
@@ -673,6 +741,11 @@
                 try
                 {
                     var getDoorLockTempPasswordData = new ZigBee.Device.DoorLock.GetDoorLockTempPasswordData();
+                    if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                    {
+                        getDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                        getDoorLockTempPasswordData.IsOtherAccountCtrl = true;
+                    }
                     if (doorLock.DeviceAddr != null)
                     {
                         getDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;

--
Gitblit v1.8.0