From 39b8b0b9bcf5805ada1a44e5dc72f05f9c6e4fcc Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 25 七月 2023 13:12:30 +0800 Subject: [PATCH] 2.0备份 --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs | 129 ++++++++++++++++++++++++------------------ 1 files changed, 73 insertions(+), 56 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs index 97ec8e1..9520088 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs @@ -18,7 +18,7 @@ VerticalScrolViewLayout contentView; FrameLayout userPermissionsView; - Button btnUserName; + //Button btnUserName; Function device; VideoDoorlockUser doorlockUser; @@ -75,7 +75,7 @@ }; userNameView.AddChidren(btnEditUserNameIcon); - btnUserName = new Button() + var btnUserName = new Button() { X = Application.GetRealWidth(100), Width = Application.GetRealWidth(230), @@ -94,6 +94,76 @@ contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) }); initOptionView(false); + + 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; + } + if (System.Text.Encoding.Default.GetBytes(str).Length > 20) + { + new Tip() + { + CloseTime = 1, + Text = Language.StringByID(StringId.LengthOutOfRange), + Direction = AMPopTipDirection.None, + }.Show(bodyView); + 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(); + }; + var pa = new PublicAssmebly(); + pa.entryMaxLength = 20; + pa.LoadDialog_EditParater(StringId.ChangeName, doorlockUser.lockUserName, callBack, StringId.UesrNameCannotBeEmpty, 0, new List<string>()); + }; + btnUserName.MouseUpEventHandler = eventHandler; + btnEditUserNameIcon.MouseUpEventHandler = eventHandler; + userNameView.MouseUpEventHandler = eventHandler; + } void initOptionView(bool isEdit) @@ -712,60 +782,7 @@ /// </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; + //btnUserName.MouseUpEventHandler = eventHandler; } -- Gitblit v1.8.0