| | |
| | | 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; |
| | |
| | | VerticalScrolViewLayout contentView; |
| | | FrameLayout userPermissionsView; |
| | | |
| | | Button btnUserName; |
| | | //Button btnUserName; |
| | | |
| | | Function device; |
| | | VideoDoorlockUser doorlockUser; |
| | | public Action delCallBackAction; |
| | | public Action<string> updataUserNameAction; |
| | | Loading waitPage; |
| | | |
| | | |
| | | public VideoDoorlockUserManagerPage(Function function,VideoDoorlockUser user) |
| | | { |
| | |
| | | device = function; |
| | | doorlockUser = user; |
| | | BackgroundColor = CSS_Color.BackgroundColor; |
| | | waitPage = new Loading(); |
| | | |
| | | } |
| | | |
| | | public override void RemoveFromParent() |
| | | { |
| | | base.RemoveFromParent(); |
| | | bodyView = null; |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.AddChidren(waitPage); |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.UserManagement)).LoadTopView(); |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | |
| | | Height = Application.GetRealHeight(667 - 70), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | |
| | | #region 用户名称 |
| | | var userNameView = new FrameLayout() |
| | |
| | | }; |
| | | userNameView.AddChidren(btnEditUserNameIcon); |
| | | |
| | | btnUserName = new Button() |
| | | var btnUserName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(100), |
| | | Width = Application.GetRealWidth(230), |
| | |
| | | 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.Unicode.GetBytes(str).Length > 20) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.LengthOutOfRange), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | var pack = ApiUtlis.Ins.HttpRequest.EditDoorlockUserName(device.deviceId, doorlockUser.extUserId, str); |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnUserName.Text = str; |
| | | updataUserNameAction?.Invoke(str); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //失败提示 |
| | | 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) |
| | | { |
| | | 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(userPermissionsView!= null) |
| | | if(doorlockUser.faceCount == 0&& |
| | | doorlockUser.fingerCount == 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 + 100); |
| | | if (userPermissionsView!= null) |
| | | { |
| | | userPermissionsView.RemoveAll(); |
| | | |
| | | if (isEdit) |
| | | { |
| | | permissionsViewHeight = Application.GetRealHeight(391 + 50 + 100); |
| | | childrenViewHeight = Application.GetRealWidth(156); |
| | | } |
| | | userPermissionsView.Height = permissionsViewHeight ; |
| | | } |
| | | int childrenViewHeight = Application.GetRealHeight( 108); |
| | | int permissionsViewHeight = Application.GetRealHeight( 291+92); |
| | | if (isEdit) |
| | | else |
| | | { |
| | | permissionsViewHeight = Application.GetRealHeight(391 + 92); |
| | | childrenViewHeight = Application.GetRealHeight(136); |
| | | userPermissionsView = new FrameLayout() |
| | | { |
| | | Height = permissionsViewHeight, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(userPermissionsView); |
| | | } |
| | | |
| | | #region 门锁用户开锁方式管理 |
| | | userPermissionsView = new FrameLayout() |
| | | { |
| | | Height = permissionsViewHeight, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(userPermissionsView); |
| | | |
| | | var userPermissionsTitleView = new FrameLayout() |
| | | { |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextID = StringId.Edit, |
| | | TextID = !isEdit? StringId.Edit: StringId.Complete, |
| | | }; |
| | | userPermissionsTitleView.AddChidren(btnEditUserPermissions); |
| | | btnEditUserPermissions.MouseUpEventHandler = (sender, e) => { |
| | | initOptionView(isEdit ? false : true); |
| | | if(!isEdit) |
| | | { |
| | | initOptionView(true); |
| | | } |
| | | else |
| | | { |
| | | initOptionView(false); |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | |
| | | var unlockOptionView = new FrameLayout() |
| | | { |
| | | Y = userPermissionsTitleView.Bottom, |
| | | Height = Application.GetRealHeight(231), |
| | | Height =2 * childrenViewHeight +Application.GetRealHeight(20), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | userPermissionsView.AddChidren(unlockOptionView); |
| | |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(64 + 32), |
| | | Height = Application.GetRealHeight(64 + 24 + 20) |
| | | Height = childrenViewHeight |
| | | }; |
| | | unlockOptionView.AddChidren(fingerprintView); |
| | | |
| | |
| | | { |
| | | btnFingerprintText.Text = doorlockUser.fingerCount + " " + Language.StringByID(StringId.Fingerprints); |
| | | } |
| | | } |
| | | |
| | | if (isEdit) |
| | | { |
| | | var btnClearFingerprints = new Button() |
| | | if (isEdit) |
| | | { |
| | | 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, |
| | | }; |
| | | fingerprintView.AddChidren(btnClearFingerprints); |
| | | btnClearFingerprints.MouseUpEventHandler = (sender, e) => { |
| | | |
| | | }; |
| | | 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) => |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | 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 |
| | | |
| | |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(64 + 32), |
| | | Height = Application.GetRealHeight(64 + 24 + 20) |
| | | Height = childrenViewHeight |
| | | }; |
| | | unlockOptionView.AddChidren(digitalPasswordView); |
| | | |
| | |
| | | }; |
| | | 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) |
| | | { |
| | | var btnClearDigitalPassword = new Button() |
| | | if (isEdit) |
| | | { |
| | | 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, |
| | | }; |
| | | digitalPasswordView.AddChidren(btnClearDigitalPassword); |
| | | 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) => |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | 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 |
| | | |
| | |
| | | { |
| | | X = Application.GetRealWidth(263), |
| | | Width = Application.GetRealWidth(64 + 32), |
| | | Height = Application.GetRealHeight(64 + 24 + 20) |
| | | Height = childrenViewHeight |
| | | }; |
| | | unlockOptionView.AddChidren(nfcView); |
| | | |
| | |
| | | }; |
| | | 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) |
| | | { |
| | | var btnClearNfc = new Button() |
| | | if (isEdit) |
| | | { |
| | | 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, |
| | | }; |
| | | nfcView.AddChidren(btnClearNfc); |
| | | 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) => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | 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 |
| | | |
| | |
| | | X = Application.GetRealWidth(16), |
| | | Y = fingerprintView.Bottom+ Application.GetRealHeight(20), |
| | | Width = Application.GetRealWidth(64 + 32), |
| | | Height = Application.GetRealHeight(64 + 24 + 20) |
| | | Height = childrenViewHeight |
| | | }; |
| | | unlockOptionView.AddChidren(faceView); |
| | | |
| | |
| | | }; |
| | | 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) |
| | | { |
| | | var btnClearFace = new Button() |
| | | if (isEdit) |
| | | { |
| | | 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, |
| | | }; |
| | | faceView.AddChidren(btnClearFace); |
| | | 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) => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | 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 |
| | | |
| | |
| | | |
| | | var delUserView = new FrameLayout() |
| | | { |
| | | Y = permissionsViewHeight - Application.GetRealHeight(92), |
| | | Height = Application.GetRealHeight(92), |
| | | Y = unlockOptionView.Bottom, |
| | | Height = Application.GetRealHeight(310), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | userPermissionsView.AddChidren(delUserView); |
| | | |
| | | Button btnDelUser = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(48), |
| | | Y = Application.GetRealHeight(40), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | 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, () => |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | 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(() => |
| | | { |
| | | if (string.IsNullOrEmpty(pack.message)) { |
| | | pack.message = Language.StringByID(StringId.OperationFailed); |
| | | } |
| | | //失败提示 |
| | | 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> |
| | | 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; |
| | | } |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | 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) |
| | | { |
| | | UserInfo.Current.userName = str; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | 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(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { 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; |
| | | } |
| | | |
| | | |