From 1b56157e8edc3f502810820d99b607e3629c7171 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 19 七月 2023 09:42:00 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into wjc

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

diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs
new file mode 100644
index 0000000..97ec8e1
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs
@@ -0,0 +1,774 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
+using HDL_ON.DriverLayer;
+using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
+using Shared;
+
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    /// <summary>
+    /// 瑙嗛闂ㄩ攣鐢ㄦ埛绠$悊鐣岄潰
+    /// </summary>
+    public class VideoDoorlockUserManagerPage : FrameLayout
+    {
+        FrameLayout bodyView;
+        VerticalScrolViewLayout contentView;
+        FrameLayout userPermissionsView;
+
+        Button btnUserName;
+
+        Function device;
+        VideoDoorlockUser doorlockUser;
+        public Action delCallBackAction;
+
+        Loading waitPage;
+
+        public VideoDoorlockUserManagerPage(Function function,VideoDoorlockUser user)
+        {
+            bodyView = this;
+            device = function;
+            doorlockUser = user;
+            BackgroundColor = CSS_Color.BackgroundColor;
+            waitPage = new Loading();
+            bodyView.AddChidren(waitPage);
+            waitPage.Hide();
+        }
+
+        public void LoadPage()
+        {
+            new TopViewDiv(bodyView, Language.StringByID(StringId.UserManagement)).LoadTopView();
+
+            contentView = new VerticalScrolViewLayout()
+            {
+                Y = Application.GetRealHeight(64),
+                Height = Application.GetRealHeight(667 - 70),
+            };
+            bodyView.AddChidren(contentView);
+
+            #region 鐢ㄦ埛鍚嶇О
+            var userNameView = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(50),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            contentView.AddChidren(userNameView);
+            var btnUserNameTitle = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(120),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextID = StringId.User,
+            };
+            userNameView.AddChidren(btnUserNameTitle);
+            var btnEditUserNameIcon = new Button()
+            {
+                X = Application.GetRealWidth(333),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(28),
+                Height = Application.GetMinRealAverage(28),
+                UnSelectedImagePath = "Public/EditIcon.png",
+            };
+            userNameView.AddChidren(btnEditUserNameIcon);
+
+            btnUserName = new Button()
+            {
+                X = Application.GetRealWidth(100),
+                Width = Application.GetRealWidth(230),
+                TextAlignment = TextAlignment.CenterRight,
+                TextColor = CSS_Color.PromptingColor1,
+                TextSize = CSS_FontSize.TextFontSize,
+                Text = doorlockUser.lockUserName
+            };
+            userNameView.AddChidren(btnUserName);
+            btnUserName.MouseUpEventHandler = (sender, e) => {
+                LoadEvent_EditUserName();
+            };
+
+            #endregion
+
+            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
+
+            initOptionView(false);
+        }
+
+        void initOptionView(bool isEdit)
+        {
+            if(doorlockUser.faceCount == 0&&
+                doorlockUser.faceCount == 0 &&
+                doorlockUser.pwdCount == 0 &&
+                doorlockUser.cardCount == 0)
+            {
+                new PublicAssmebly().TipMsg(StringId.Tip, StringId.VideoDoorlockDelDataTip, () =>
+                {
+                    delCallBackAction?.Invoke();
+                    this.RemoveFromParent();
+                });
+                return;
+            }
+
+
+            int childrenViewHeight = Application.GetRealWidth(116);
+            int permissionsViewHeight = Application.GetRealHeight(291 + 92);
+            if (userPermissionsView!= null)
+            {
+                userPermissionsView.RemoveAll();
+
+                if (isEdit)
+                {
+                    permissionsViewHeight = Application.GetRealHeight(391 + 50);
+                    childrenViewHeight = Application.GetRealWidth(156);
+                }
+                userPermissionsView.Height = permissionsViewHeight;
+            }
+            else
+            {
+                userPermissionsView = new FrameLayout()
+                {
+                    Height = permissionsViewHeight,
+                    BackgroundColor = CSS_Color.MainBackgroundColor,
+                };
+                contentView.AddChidren(userPermissionsView);
+            }
+
+            #region 闂ㄩ攣鐢ㄦ埛寮�閿佹柟寮忕鐞�
+
+            var userPermissionsTitleView = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(63),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            userPermissionsView.AddChidren(userPermissionsTitleView);
+
+            var btnUserPermissionsTitle = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextID = StringId.UnlockMethod
+            };
+            userPermissionsTitleView.AddChidren(btnUserPermissionsTitle);
+
+            var btnEditUserPermissions = new Button()
+            {
+                X = Application.GetRealWidth(267),
+                Width = Application.GetRealWidth(80),
+                TextAlignment = TextAlignment.CenterRight,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.MainColor,
+                TextID = !isEdit? StringId.Edit: StringId.Complete,
+            };
+            userPermissionsTitleView.AddChidren(btnEditUserPermissions);
+            btnEditUserPermissions.MouseUpEventHandler = (sender, e) => {
+                if(!isEdit)
+                {
+                    initOptionView(true);
+                }
+                else
+                {
+                    initOptionView(false);
+                }
+
+            };
+
+
+            #region 寮�閿侀�夐」
+            var unlockOptionView = new FrameLayout()
+            {
+                Y = userPermissionsTitleView.Bottom,
+                Height =2 * childrenViewHeight +Application.GetRealHeight(20),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            userPermissionsView.AddChidren(unlockOptionView);
+
+            #region 鎸囩汗
+            var fingerprintView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(64 + 32),
+                Height = childrenViewHeight
+            };
+            unlockOptionView.AddChidren(fingerprintView);
+
+            var btnFingerprintIcon = new Button()
+            {
+                Width = Application.GetRealWidth(64),
+                Height = Application.GetRealWidth(64),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/FingerprintIcon.png",
+                X = Application.GetRealWidth(16),
+            };
+            fingerprintView.AddChidren(btnFingerprintIcon);
+
+            var btnFingerprintText = new Button()
+            {
+                Y = btnFingerprintIcon.Bottom,
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.PromptingColor1,
+                TextID = StringId.Fingerprints,
+            };
+            fingerprintView.AddChidren(btnFingerprintText);
+
+            if (doorlockUser.fingerCount > 0)
+            {
+                btnFingerprintIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/FingerprintOnIcon.png";
+                btnFingerprintText.TextColor = CSS_Color.FirstLevelTitleColor;
+                if (Language.CurrentLanguage == "Chinese")
+                {
+                    btnFingerprintText.Text = doorlockUser.fingerCount + "缁�" + Language.StringByID(StringId.Fingerprints);
+                }
+                else
+                {
+                    btnFingerprintText.Text = doorlockUser.fingerCount + " " + Language.StringByID(StringId.Fingerprints);
+                }
+
+                if (isEdit)
+                {
+                    var btnClearFingerprints = new Button()
+                    {
+                        X = Application.GetRealWidth(18),
+                        Y = btnFingerprintText.Bottom,
+                        Width = Application.GetRealWidth(60),
+                        Height = Application.GetRealHeight(28),
+                        BorderWidth = 1,
+                        BorderColor = CSS_Color.MainColor,
+                        Radius = (uint)Application.GetRealWidth(4),
+                        TextID = StringId.Clear,
+                        TextColor = CSS_Color.MainColor,
+                    };
+                    fingerprintView.AddChidren(btnClearFingerprints);
+                    btnClearFingerprints.MouseUpEventHandler = (sender, e) =>
+                    {
+                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                var pack = ApiUtlis.Ins.HttpRequest.DeleteDoorlockUserFingerPassword(device.deviceId, doorlockUser.lockUserIndex);
+                                if (pack != null && pack.Code == StateCode.SUCCESS)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        doorlockUser.fingerCount = 0;
+                                        //鏇存柊鐣岄潰
+                                        initOptionView(true);
+                                    });
+                                }
+                                else
+                                {
+                                    //澶辫触鎻愮ず
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        //澶辫触鎻愮ず
+                                        var tip = new Tip()
+                                        {
+                                            MaxWidth = Application.GetRealWidth(300),
+                                            Text = pack.message,
+                                            CloseTime = 3,
+                                            Direction = AMPopTipDirection.None
+                                        };
+                                        tip.Show(MainPage.BaseView);
+                                    });
+                                }
+                            }
+                            catch (Exception ex)
+                            {
+                                MainPage.Log($"delete finger error : {ex.Message}");
+                            }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    waitPage.Hide();
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
+                    };
+                }
+            }
+            #endregion
+
+
+            #region 鏁板瓧瀵嗙爜
+            var digitalPasswordView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(64 + 32),
+                Height = childrenViewHeight
+            };
+            unlockOptionView.AddChidren(digitalPasswordView);
+
+            var btnDigitalPasswordIcon = new Button()
+            {
+                Width = Application.GetRealWidth(64),
+                Height = Application.GetRealWidth(64),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/DigitalPasswordIcon.png",
+                X = Application.GetRealWidth(16),
+            };
+            digitalPasswordView.AddChidren(btnDigitalPasswordIcon);
+
+            var btnDigitalPasswordText = new Button()
+            {
+                Y = btnDigitalPasswordIcon.Bottom,
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.PromptingColor1,
+                TextID = StringId.DigitalPassword,
+            };
+            digitalPasswordView.AddChidren(btnDigitalPasswordText);
+
+            if (doorlockUser.pwdCount > 0)
+            {
+                btnDigitalPasswordIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/DigitalPasswordOnIcon.png";
+                btnDigitalPasswordText.TextColor = CSS_Color.FirstLevelTitleColor;
+                if (Language.CurrentLanguage == "Chinese")
+                {
+                    btnDigitalPasswordText.Text = doorlockUser.pwdCount + "缁�" + Language.StringByID(StringId.DigitalPassword);
+                }
+                else
+                {
+                    btnDigitalPasswordText.Text = doorlockUser.pwdCount + " " + Language.StringByID(StringId.DigitalPassword);
+                }
+
+                if (isEdit)
+                {
+                    var btnClearDigitalPassword = new Button()
+                    {
+                        X = Application.GetRealWidth(18),
+                        Y = btnDigitalPasswordText.Bottom,
+                        Width = Application.GetRealWidth(60),
+                        Height = Application.GetRealHeight(28),
+                        BorderWidth = 1,
+                        BorderColor = CSS_Color.MainColor,
+                        Radius = (uint)Application.GetRealWidth(4),
+                        TextID = StringId.Clear,
+                        TextColor = CSS_Color.MainColor,
+                    };
+                    digitalPasswordView.AddChidren(btnClearDigitalPassword);
+                    btnClearDigitalPassword.MouseUpEventHandler = (sender, e) =>
+                    {
+                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                var pack = ApiUtlis.Ins.HttpRequest.DeleteDoorlockUserNumberPassword(device.deviceId, doorlockUser.lockUserIndex);
+                                if (pack != null && pack.Code == StateCode.SUCCESS)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        doorlockUser.pwdCount = 0;
+                                        //鏇存柊鐣岄潰
+                                        initOptionView(true);
+                                    });
+                                }
+                                else
+                                {
+                                    //澶辫触鎻愮ず
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        //澶辫触鎻愮ず
+                                        var tip = new Tip()
+                                        {
+                                            MaxWidth = Application.GetRealWidth(300),
+                                            Text = pack.message,
+                                            CloseTime = 3,
+                                            Direction = AMPopTipDirection.None
+                                        };
+                                        tip.Show(MainPage.BaseView);
+                                    });
+                                }
+                            }
+                            catch (Exception ex)
+                            {
+                                MainPage.Log($"delete number password error : {ex.Message}");
+                            }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    waitPage.Hide();
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
+                    };
+
+                }
+            }
+            #endregion
+
+            #region NFC
+            var nfcView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(263),
+                Width = Application.GetRealWidth(64 + 32),
+                Height = childrenViewHeight
+            };
+            unlockOptionView.AddChidren(nfcView);
+
+            var btnNfcIcon = new Button()
+            {
+                Width = Application.GetRealWidth(64),
+                Height = Application.GetRealWidth(64),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/NfcIcon.png",
+                X = Application.GetRealWidth(16),
+            };
+            nfcView.AddChidren(btnNfcIcon);
+
+            var btnNfcText = new Button()
+            {
+                Y = btnNfcIcon.Bottom,
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.PromptingColor1,
+                TextID = StringId.NfcKey,
+            };
+            nfcView.AddChidren(btnNfcText);
+
+            if (doorlockUser.cardCount > 0)
+            {
+                btnNfcIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/NfcOnIcon.png";
+                btnNfcText.TextColor = CSS_Color.FirstLevelTitleColor;
+                if (Language.CurrentLanguage == "Chinese")
+                {
+                    btnNfcText.Text = doorlockUser.cardCount + "缁�" + Language.StringByID(StringId.NfcKey);
+                }
+                else
+                {
+                    btnNfcText.Text = doorlockUser.cardCount + " " + Language.StringByID(StringId.NfcKey);
+                }
+
+                if (isEdit)
+                {
+                    var btnClearNfc = new Button()
+                    {
+                        X = Application.GetRealWidth(18),
+                        Y = btnNfcText.Bottom,
+                        Width = Application.GetRealWidth(60),
+                        Height = Application.GetRealHeight(28),
+                        BorderWidth = 1,
+                        BorderColor = CSS_Color.MainColor,
+                        Radius = (uint)Application.GetRealWidth(4),
+                        TextID = StringId.Clear,
+                        TextColor = CSS_Color.MainColor,
+                    };
+                    nfcView.AddChidren(btnClearNfc);
+                    btnClearNfc.MouseUpEventHandler = (sender, e) => {
+                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                var pack = ApiUtlis.Ins.HttpRequest.DeleteDoorlockUserCardPassword(device.deviceId, doorlockUser.lockUserIndex);
+                                if (pack != null && pack.Code == StateCode.SUCCESS)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        doorlockUser.cardCount = 0;
+                                        //鏇存柊鐣岄潰
+                                        initOptionView(true);
+                                    });
+                                }
+                                else
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        //澶辫触鎻愮ず
+                                        var tip = new Tip()
+                                        {
+                                            MaxWidth = Application.GetRealWidth(300),
+                                            Text = pack.message,
+                                            CloseTime = 3,
+                                            Direction = AMPopTipDirection.None
+                                        };
+                                        tip.Show(MainPage.BaseView);
+                                    });
+                                }
+                            }
+                            catch (Exception ex)
+                            {
+                                MainPage.Log($"delete face error : {ex.Message}");
+                            }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    waitPage.Hide();
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
+                    };
+                }
+            }
+            #endregion
+
+            #region 浜鸿劯
+            var faceView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(16),
+                Y = fingerprintView.Bottom+ Application.GetRealHeight(20),
+                Width = Application.GetRealWidth(64 + 32),
+                Height = childrenViewHeight
+            };
+            unlockOptionView.AddChidren(faceView);
+
+            var btnFaceIcon = new Button()
+            {
+                Width = Application.GetRealWidth(64),
+                Height = Application.GetRealWidth(64),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/FaceIcon.png",
+                X = Application.GetRealWidth(16),
+            };
+            faceView.AddChidren(btnFaceIcon);
+
+            var btnFaceText = new Button()
+            {
+                Y = btnFaceIcon.Bottom,
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.PromptingColor1,
+                TextID = StringId.FaceKey,
+            };
+            faceView.AddChidren(btnFaceText);
+
+            if (doorlockUser.faceCount > 0)
+            {
+                btnFaceIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/FaceOnIcon.png";
+                btnFaceText.TextColor = CSS_Color.FirstLevelTitleColor;
+                if (Language.CurrentLanguage == "Chinese")
+                {
+                    btnFaceText.Text = doorlockUser.faceCount + "缁�" + Language.StringByID(StringId.FaceKey);
+                }
+                else
+                {
+                    btnFaceText.Text = doorlockUser.faceCount + " " + Language.StringByID(StringId.FaceKey);
+                }
+
+                if (isEdit)
+                {
+                    var btnClearFace = new Button()
+                    {
+                        X = Application.GetRealWidth(18),
+                        Y = btnFaceText.Bottom,
+                        Width = Application.GetRealWidth(60),
+                        Height = Application.GetRealHeight(28),
+                        BorderWidth = 1,
+                        BorderColor = CSS_Color.MainColor,
+                        Radius = (uint)Application.GetRealWidth(4),
+                        TextID = StringId.Clear,
+                        TextColor = CSS_Color.MainColor,
+                    };
+                    faceView.AddChidren(btnClearFace);
+                    btnClearFace.MouseUpEventHandler = (sender, e) => {
+                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                var pack = ApiUtlis.Ins.HttpRequest.DeleteDoorlockUserFacePassword(device.deviceId, doorlockUser.lockUserIndex);
+                                if (pack != null && pack.Code == StateCode.SUCCESS)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        doorlockUser.faceCount = 0;
+                                        //鏇存柊鐣岄潰
+                                        initOptionView(true);
+                                    });
+                                }
+                                else
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        //澶辫触鎻愮ず
+                                        var tip = new Tip()
+                                        {
+                                            MaxWidth = Application.GetRealWidth(300),
+                                            Text = pack.message,
+                                            CloseTime = 3,
+                                            Direction = AMPopTipDirection.None
+                                        };
+                                        tip.Show(MainPage.BaseView);
+                                    });
+                                }
+                            }
+                            catch (Exception ex)
+                            {
+                                MainPage.Log($"delete face error : {ex.Message}");
+                            }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    waitPage.Hide();
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
+                    };
+
+                }
+            }
+            #endregion
+
+            #endregion
+
+            #endregion
+
+            var delUserView = new FrameLayout()
+            {
+                Y = unlockOptionView.Bottom,
+                Height = Application.GetRealHeight(110),
+                BackgroundColor = CSS_Color.BackgroundColor,
+            };
+            userPermissionsView.AddChidren(delUserView);
+
+            Button btnDelUser = new Button()
+            {
+                Y = Application.GetRealHeight(40),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(220),
+                Height = Application.GetRealWidth(44),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                TextColor = CSS_Color.WarningColor,
+                Radius = (uint)Application.GetRealWidth(22),
+                TextID = StringId.DeleteUser,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+            };
+            delUserView.AddChidren(btnDelUser);
+
+            btnDelUser.MouseUpEventHandler = (sender, e) =>
+            {
+                new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DeleteDoorlockUserTip, () =>
+                {
+                    waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    new System.Threading.Thread(() =>
+                    {
+                        try
+                        {
+                            var pack = ApiUtlis.Ins.HttpRequest.DeleteDoorlockUser(device.deviceId, doorlockUser.lockUserIndex);
+                            if (pack != null && pack.Code == StateCode.SUCCESS)
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    //鏇存柊鐣岄潰
+                                    new PublicAssmebly().TipMsg(StringId.Tip, StringId.DeleteSuccess, () => {
+                                        this.RemoveFromParent();
+                                        delCallBackAction?.Invoke();
+                                    });
+                                });
+                            }
+                            else
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    //澶辫触鎻愮ず
+                                    var tip = new Tip()
+                                    {
+                                        MaxWidth = Application.GetRealWidth(300),
+                                        Text = pack.message,
+                                        CloseTime = 3,
+                                        Direction = AMPopTipDirection.None
+                                    };
+                                    tip.Show(MainPage.BaseView);
+                                });
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"delete face error : {ex.Message}");
+                        }
+                        finally
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                waitPage.Hide();
+                            });
+                        }
+                    })
+                    { IsBackground = true }.Start();
+                });
+            };
+
+
+
+        }
+
+
+
+        /// <summary>
+        /// 鍔犺浇淇敼鐢ㄦ埛鍚嶇О浜嬩欢
+        /// </summary>
+        void LoadEvent_EditUserName()
+        {
+            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+            {
+                Action<string> callBack = (str) =>
+                {
+                    if (string.IsNullOrEmpty(str))
+                    {
+                        new Tip()
+                        {
+                            CloseTime = 1,
+                            Text = Language.StringByID(StringId.UesrNameCannotBeEmpty),
+                            Direction = AMPopTipDirection.None,
+                        }.Show(bodyView);
+                        return;
+                    }
+                    if (str == UserInfo.Current.userName)
+                    {
+                        return;
+                    }
+                    waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                    new System.Threading.Thread(() =>
+                    {
+                        try
+                        {
+                            var resultObj = ApiUtlis.Ins.HttpRequest.EditDoorlockUserName(device.deviceId, doorlockUser.extUserId,str);
+                            if (resultObj.Code == StateCode.SUCCESS)
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    btnUserName.Text = str;
+                                });
+                            }
+                            else
+                            {
+                                //澶辫触鎻愮ず
+                                IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"update user name error : {ex.Message}");
+                        }
+                        finally
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                waitPage.Hide();
+                            });
+                        }
+                    })
+                    { IsBackground = true }.Start();
+                };
+                new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, doorlockUser.lockUserName, callBack, StringId.UesrNameCannotBeEmpty, 0, new System.Collections.Generic.List<string>());
+            };
+            btnUserName.MouseUpEventHandler = eventHandler;
+        }
+
+
+
+    }
+}

--
Gitblit v1.8.0