From 489d3bd60ad7dc2fecb398b09cf4c52df16f0fc2 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期三, 26 七月 2023 15:55:30 +0800 Subject: [PATCH] Merge branch 'Dev-Branch' of http://59.41.255.150:6688/r/~wxr/OnPro into Dev-Branch --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs | 141 ++++++++++++++++++++++++++-------------------- 1 files changed, 80 insertions(+), 61 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs index 97ec8e1..6f1f608 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; @@ -48,6 +48,8 @@ }; bodyView.AddChidren(contentView); + + #region 鐢ㄦ埛鍚嶇О var userNameView = new FrameLayout() { @@ -75,7 +77,7 @@ }; userNameView.AddChidren(btnEditUserNameIcon); - btnUserName = new Button() + var btnUserName = new Button() { X = Application.GetRealWidth(100), Width = Application.GetRealWidth(230), @@ -94,12 +96,82 @@ 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, "", callBack, StringId.UesrNameCannotBeEmpty, 0, new List<string>()); + }; + btnUserName.MouseUpEventHandler = eventHandler; + btnEditUserNameIcon.MouseUpEventHandler = eventHandler; + userNameView.MouseUpEventHandler = eventHandler; + } void initOptionView(bool isEdit) { if(doorlockUser.faceCount == 0&& - doorlockUser.faceCount == 0 && + doorlockUser.fingerCount == 0 && doorlockUser.pwdCount == 0 && doorlockUser.cardCount == 0) { @@ -113,17 +185,17 @@ int childrenViewHeight = Application.GetRealWidth(116); - int permissionsViewHeight = Application.GetRealHeight(291 + 92); + int permissionsViewHeight = Application.GetRealHeight(291 + 92 + 100); if (userPermissionsView!= null) { userPermissionsView.RemoveAll(); if (isEdit) { - permissionsViewHeight = Application.GetRealHeight(391 + 50); + permissionsViewHeight = Application.GetRealHeight(391 + 50 + 100); childrenViewHeight = Application.GetRealWidth(156); } - userPermissionsView.Height = permissionsViewHeight; + userPermissionsView.Height = permissionsViewHeight ; } else { @@ -629,7 +701,7 @@ var delUserView = new FrameLayout() { Y = unlockOptionView.Bottom, - Height = Application.GetRealHeight(110), + Height = Application.GetRealHeight(310), BackgroundColor = CSS_Color.BackgroundColor, }; userPermissionsView.AddChidren(delUserView); @@ -712,60 +784,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