From eaaa2635f9ef5e431e00df922731a54c20cf7016 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 31 七月 2023 19:41:58 +0800
Subject: [PATCH] 三相空开备份

---
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs |   73 ++++++++++++++++++++++++++++++++----
 1 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs
index 6f1f608..16705c7 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs
@@ -24,7 +24,6 @@
         VideoDoorlockUser doorlockUser;
         public Action delCallBackAction;
 
-        Loading waitPage;
 
         public VideoDoorlockUserManagerPage(Function function,VideoDoorlockUser user)
         {
@@ -32,9 +31,7 @@
             device = function;
             doorlockUser = user;
             BackgroundColor = CSS_Color.BackgroundColor;
-            waitPage = new Loading();
-            bodyView.AddChidren(waitPage);
-            waitPage.Hide();
+            
         }
 
         public void LoadPage()
@@ -115,7 +112,7 @@
                     {
                         return;
                     }
-                    if (System.Text.Encoding.Default.GetBytes(str).Length > 20)
+                    if (System.Text.Encoding.UTF8.GetBytes(str).Length > 20)
                     {
                         new Tip()
                         {
@@ -125,13 +122,15 @@
                         }.Show(bodyView);
                         return;
                     }
+                    var waitPage = new Loading();
                     waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    bodyView.AddChidren(waitPage);
                     new System.Threading.Thread(() =>
                     {
                         try
                         {
-                            var resultObj = ApiUtlis.Ins.HttpRequest.EditDoorlockUserName(device.deviceId, doorlockUser.extUserId, str);
-                            if (resultObj.Code == StateCode.SUCCESS)
+                            var pack = ApiUtlis.Ins.HttpRequest.EditDoorlockUserName(device.deviceId, doorlockUser.extUserId, str);
+                            if (pack.Code == StateCode.SUCCESS)
                             {
                                 Application.RunOnMainThread(() =>
                                 {
@@ -141,7 +140,23 @@
                             else
                             {
                                 //澶辫触鎻愮ず
-                                IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
+                                Application.RunOnMainThread(() =>
+                                {
+                                    if (string.IsNullOrEmpty(pack.message))
+                                    {
+                                        pack.message = Language.StringByID(StringId.OperationFailed);
+                                    }
+                                    {
+                                        var tip = new Tip()
+                                        {
+                                            MaxWidth = Application.GetRealWidth(300),
+                                            Text = $"{pack.message}({pack.Code})",
+                                            CloseTime = 3,
+                                            Direction = AMPopTipDirection.None
+                                        };
+                                        tip.Show(MainPage.BaseView);
+                                    }
+                                });
                             }
                         }
                         catch (Exception ex)
@@ -153,6 +168,11 @@
                             Application.RunOnMainThread(() =>
                             {
                                 waitPage.Hide();
+                                if(waitPage!= null)
+                                {
+                                    waitPage.RemoveFromParent();
+                                    waitPage = null;
+                                }
                             });
                         }
                     })
@@ -317,7 +337,9 @@
                     fingerprintView.AddChidren(btnClearFingerprints);
                     btnClearFingerprints.MouseUpEventHandler = (sender, e) =>
                     {
+                        var waitPage = new Loading();
                         waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    bodyView.AddChidren(waitPage);
                         new System.Threading.Thread(() =>
                         {
                             try
@@ -358,6 +380,11 @@
                                 Application.RunOnMainThread(() =>
                                 {
                                     waitPage.Hide();
+                                    if (waitPage != null)
+                                    {
+                                        waitPage.RemoveFromParent();
+                                        waitPage = null;
+                                    }
                                 });
                             }
                         })
@@ -427,7 +454,9 @@
                     digitalPasswordView.AddChidren(btnClearDigitalPassword);
                     btnClearDigitalPassword.MouseUpEventHandler = (sender, e) =>
                     {
+                        var waitPage = new Loading();
                         waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    bodyView.AddChidren(waitPage);
                         new System.Threading.Thread(() =>
                         {
                             try
@@ -468,6 +497,11 @@
                                 Application.RunOnMainThread(() =>
                                 {
                                     waitPage.Hide();
+                                    if (waitPage != null)
+                                    {
+                                        waitPage.RemoveFromParent();
+                                        waitPage = null;
+                                    }
                                 });
                             }
                         })
@@ -536,7 +570,9 @@
                     };
                     nfcView.AddChidren(btnClearNfc);
                     btnClearNfc.MouseUpEventHandler = (sender, e) => {
+                        var waitPage = new Loading();
                         waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    bodyView.AddChidren(waitPage);
                         new System.Threading.Thread(() =>
                         {
                             try
@@ -576,6 +612,11 @@
                                 Application.RunOnMainThread(() =>
                                 {
                                     waitPage.Hide();
+                                    if (waitPage != null)
+                                    {
+                                        waitPage.RemoveFromParent();
+                                        waitPage = null;
+                                    }
                                 });
                             }
                         })
@@ -644,7 +685,9 @@
                     };
                     faceView.AddChidren(btnClearFace);
                     btnClearFace.MouseUpEventHandler = (sender, e) => {
+                        var waitPage = new Loading();
                         waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    bodyView.AddChidren(waitPage);
                         new System.Threading.Thread(() =>
                         {
                             try
@@ -684,6 +727,11 @@
                                 Application.RunOnMainThread(() =>
                                 {
                                     waitPage.Hide();
+                                    if (waitPage != null)
+                                    {
+                                        waitPage.RemoveFromParent();
+                                        waitPage = null;
+                                    }
                                 });
                             }
                         })
@@ -724,6 +772,7 @@
             {
                 new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DeleteDoorlockUserTip, () =>
                 {
+                    var waitPage = new Loading();
                     waitPage.Start(Language.StringByID(StringId.PleaseWait));
                     new System.Threading.Thread(() =>
                     {
@@ -745,6 +794,9 @@
                             {
                                 Application.RunOnMainThread(() =>
                                 {
+                                    if (string.IsNullOrEmpty(pack.message)) {
+                                        pack.message = Language.StringByID(StringId.OperationFailed);
+                                    }
                                     //澶辫触鎻愮ず
                                     var tip = new Tip()
                                     {
@@ -766,6 +818,11 @@
                             Application.RunOnMainThread(() =>
                             {
                                 waitPage.Hide();
+                                if (waitPage != null)
+                                {
+                                    waitPage.RemoveFromParent();
+                                    waitPage = null;
+                                }
                             });
                         }
                     })

--
Gitblit v1.8.0