From 18b93d511dc764b469d7c4a7e755f7274f89cdb4 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 27 四月 2020 17:55:14 +0800
Subject: [PATCH] 2020-4-27-1

---
 ZigbeeApp/Shared/Phone/UserCenter/Safety/PasswordUserEditorForm.cs |   57 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/PasswordUserEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/PasswordUserEditorForm.cs
index a9ade58..41ce528 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Safety/PasswordUserEditorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/PasswordUserEditorForm.cs
@@ -30,6 +30,8 @@
         {
             this.pswNo = i_pswNo;
 
+            this.ScrollEnabled = false;
+
             //璁剧疆澶撮儴淇℃伅
             base.SetTitleText(i_passwordTip);
 
@@ -47,13 +49,17 @@
             //娓呯┖bodyFrame
             this.ClearBodyFrame();
 
+            var listBackControl = new VerticalFrameControl();
+            listBackControl.Height = bodyFrameLayout.Height;
+            bodyFrameLayout.AddChidren(listBackControl);
+
             var frameback = new FrameLayout();
             frameback.Y = Application.GetRealHeight(179);
             frameback.Height = Application.GetRealHeight(395);
             frameback.Width = Application.GetRealWidth(717);
             frameback.Gravity = Gravity.CenterHorizontal;
             frameback.BackgroundImagePath = "Safeguard/SafeguardPasswordGround.png";
-            bodyFrameLayout.AddChidren(frameback);
+            listBackControl.frameTable.AddChidren(frameback);
             //褰撳墠浣跨敤瀵嗙爜
             var btnNowTip = new NormalViewControl(frameback.Width, Application.GetRealHeight(50), false);
             btnNowTip.Y = Application.GetRealHeight(81);
@@ -72,7 +78,7 @@
 
             //鍒濆鍖栨甯�
             var tableContr = new InformationEditorControl();
-            var listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 711, 1025);
+            var listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 1025);
 
             //澶囨敞淇℃伅
             string caption = Language.StringByID(R.MyInternationalizationString.uNoteInformation);
@@ -82,7 +88,7 @@
             listview.AddChidren(rowNote);
             rowNote.InitControl();
             rowNote.AddBottomLine();
-            rowNote.txtInput.FinishInputEvent += () =>
+            rowNote.txtInput.FinishInputEvent += async () =>
             {
                 if (rowNote.Text == string.Empty)
                 {
@@ -92,7 +98,11 @@
                 if (i_passwordTip != rowNote.Text)
                 {
                     //淇敼瀵嗙爜澶囨敞
-                    this.EditorPassworTip(i_password, rowNote.Text);
+                    var result = await this.EditorPassworTip(i_password, rowNote.Text, true);
+                    if (result == true)
+                    {
+                        i_passwordTip = rowNote.Text;
+                    }
                 }
             };
 
@@ -106,11 +116,36 @@
             {
                 var form = new PasswordAddNewForm();
                 form.AddForm(this.pswNo, rowNote.Text);
+                form.PasswordChangedEvent += (newPassword) =>
+                {
+                    btnPassword.Text = newPassword;
+                    i_password = newPassword;
+                };
             };
 
             //鍒濆鍖栨甯冨畬鎴�
-            tableContr.FinishInitControl(bodyFrameLayout, listview);
+            tableContr.FinishInitControl();
             tableContr = null;
+
+            //閲嶅啓搴曞眰杩斿洖鎸夐敭鐨勪簨浠�
+            this.BackButtonClickEvent = async (sender) =>
+            {
+                sender.CanClick = false;
+                if (rowNote.Text == string.Empty || i_passwordTip == rowNote.Text)
+                {
+                    this.CloseForm();
+                }
+                else
+                {
+                    //淇敼瀵嗙爜澶囨敞
+                    var result = await this.EditorPassworTip(i_password, rowNote.Text, false);
+                    sender.CanClick = true;
+                    if (result == true)
+                    {
+                        this.CloseForm();
+                    }
+                }
+            };
         }
 
         #endregion
@@ -122,17 +157,21 @@
         /// </summary>
         /// <param name="i_password">鐢ㄦ埛瀵嗙爜</param>
         /// <param name="i_passwordTip">鐢ㄦ埛瀵嗙爜鎻愮ず</param>
-        private async void EditorPassworTip(string i_password, string i_passwordTip)
+        private async System.Threading.Tasks.Task<bool> EditorPassworTip(string i_password, string i_passwordTip, bool ShowMsg)
         {
             var result = await HdlSafeguardLogic.Current.AddPassWordTips(this.pswNo, i_password, i_passwordTip);
             if (result == true)
             {
-                //淇敼澶囨敞淇℃伅鎴愬姛!
-                string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationSuccess);
-                this.ShowMassage(ShowMsgType.Tip, msg);
+                if (ShowMsg == true)
+                {
+                    //淇敼澶囨敞淇℃伅鎴愬姛!
+                    string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationSuccess);
+                    this.ShowMassage(ShowMsgType.Tip, msg);
+                }
                 //璁剧疆澶撮儴淇℃伅
                 base.SetTitleText(i_passwordTip);
             }
+            return result;
         }
 
         #endregion

--
Gitblit v1.8.0