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 | 167 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 101 insertions(+), 66 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserManagerPage.cs index 36eea30..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,10 +94,94 @@ 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) { + 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) @@ -241,6 +325,7 @@ { Application.RunOnMainThread(() => { + doorlockUser.fingerCount = 0; //鏇存柊鐣岄潰 initOptionView(true); }); @@ -310,17 +395,17 @@ }; digitalPasswordView.AddChidren(btnDigitalPasswordText); - if (doorlockUser.fingerCount > 0) + if (doorlockUser.pwdCount > 0) { btnDigitalPasswordIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/DigitalPasswordOnIcon.png"; btnDigitalPasswordText.TextColor = CSS_Color.FirstLevelTitleColor; if (Language.CurrentLanguage == "Chinese") { - btnDigitalPasswordText.Text = doorlockUser.fingerCount + "缁�" + Language.StringByID(StringId.DigitalPassword); + btnDigitalPasswordText.Text = doorlockUser.pwdCount + "缁�" + Language.StringByID(StringId.DigitalPassword); } else { - btnDigitalPasswordText.Text = doorlockUser.fingerCount + " " + Language.StringByID(StringId.DigitalPassword); + btnDigitalPasswordText.Text = doorlockUser.pwdCount + " " + Language.StringByID(StringId.DigitalPassword); } if (isEdit) @@ -350,6 +435,7 @@ { Application.RunOnMainThread(() => { + doorlockUser.pwdCount = 0; //鏇存柊鐣岄潰 initOptionView(true); }); @@ -419,17 +505,17 @@ }; nfcView.AddChidren(btnNfcText); - if (doorlockUser.fingerCount > 0) + if (doorlockUser.cardCount > 0) { btnNfcIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/NfcOnIcon.png"; btnNfcText.TextColor = CSS_Color.FirstLevelTitleColor; if (Language.CurrentLanguage == "Chinese") { - btnNfcText.Text = doorlockUser.fingerCount + "缁�" + Language.StringByID(StringId.NfcKey); + btnNfcText.Text = doorlockUser.cardCount + "缁�" + Language.StringByID(StringId.NfcKey); } else { - btnNfcText.Text = doorlockUser.fingerCount + " " + Language.StringByID(StringId.NfcKey); + btnNfcText.Text = doorlockUser.cardCount + " " + Language.StringByID(StringId.NfcKey); } if (isEdit) @@ -458,6 +544,7 @@ { Application.RunOnMainThread(() => { + doorlockUser.cardCount = 0; //鏇存柊鐣岄潰 initOptionView(true); }); @@ -500,7 +587,7 @@ var faceView = new FrameLayout() { X = Application.GetRealWidth(16), - Y = fingerprintView.Bottom, + Y = fingerprintView.Bottom+ Application.GetRealHeight(20), Width = Application.GetRealWidth(64 + 32), Height = childrenViewHeight }; @@ -526,17 +613,17 @@ }; faceView.AddChidren(btnFaceText); - if (doorlockUser.fingerCount > 0) + if (doorlockUser.faceCount > 0) { btnFaceIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/UserRightsManagement/FaceOnIcon.png"; btnFaceText.TextColor = CSS_Color.FirstLevelTitleColor; if (Language.CurrentLanguage == "Chinese") { - btnFaceText.Text = doorlockUser.fingerCount + "缁�" + Language.StringByID(StringId.FaceKey); + btnFaceText.Text = doorlockUser.faceCount + "缁�" + Language.StringByID(StringId.FaceKey); } else { - btnFaceText.Text = doorlockUser.fingerCount + " " + Language.StringByID(StringId.FaceKey); + btnFaceText.Text = doorlockUser.faceCount + " " + Language.StringByID(StringId.FaceKey); } if (isEdit) @@ -565,6 +652,7 @@ { Application.RunOnMainThread(() => { + doorlockUser.faceCount = 0; //鏇存柊鐣岄潰 initOptionView(true); }); @@ -694,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