using System; using System.Collections.Generic; using HDL_ON.Common; using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock { public class VideoDoorlockUserListPage : FrameLayout { FrameLayout bodyView; VerticalScrolViewLayout contentView; Function device; List userList; public VideoDoorlockUserListPage(Function function) { bodyView = this; device = function; userList = new List(); } public void LoadPage() { new TopViewDiv(bodyView, Language.StringByID(StringId.UserManagement)).LoadTopView(); bodyView.BackgroundColor = CSS_Color.BackgroundColor; contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(607 - 70), }; bodyView.AddChidren(contentView); var btnTip = new Button() { Y = Application.GetRealHeight(667 - 70), Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(60), TextAlignment = TextAlignment.TopLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextColor = CSS_Color.TextualColor, TextID = StringId.VideoDoorlockManagerTip, IsMoreLines = true, }; bodyView.AddChidren(btnTip); var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(""); new System.Threading.Thread(() => { try { var pack = ApiUtlis.Ins.HttpRequest.GetDoorlockUserList(device.deviceId); if (pack != null) { if (pack.Code == StateCode.SUCCESS) { userList = Newtonsoft.Json.JsonConvert.DeserializeObject>(pack.Data.ToString()); if (userList != null) { Application.RunOnMainThread(() => { initView(); }); } } else { Application.RunOnMainThread(() => { IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); }); } } } catch (Exception ex) { MainPage.Log($"获取门锁用户异常:{ex.Message}"); } finally { Application.RunOnMainThread(() => { waitPage.Hide(); }); } }) { IsBackground = true }.Start(); } void initView() { contentView.RemoveAll(); foreach (var user in userList) { contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); var row = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Height = Application.GetRealHeight(50), Radius = (uint)Application.GetRealWidth(12), BackgroundColor = CSS_Color.MainBackgroundColor, Width = Application.GetRealWidth(343), }; contentView.AddChidren(row); var btnRight = new Button() { X = Application.GetRealWidth(307), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; row.AddChidren(btnRight); var btnName = new Button() { X = Application.GetRealWidth(12), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, Text = user.lockUserName }; row.AddChidren(btnName); btnName.MouseUpEventHandler = (sender, e) => { var page = new VideoDoorlockUserManagerPage(device, user); page.delCallBackAction = () => { userList.Remove(user); initView(); }; page.updataUserNameAction = (name) => { btnName.Text = name; user.lockUserName = name; }; MainPage.BasePageView.AddChidren(page); page.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; } } } public class VideoDoorlockUser { /// /// 开始时间 integer(int32) /// public string beginTime; /// /// 感应卡密码数量 integer(int32) /// public int cardCount; /// /// 结束时间 integer(int32) /// public int endTime; /// /// 是否过期 integer(int32) /// public string expiredEnable; /// /// 门锁用户id string /// public string extUserId; /// /// string /// public string extUserName; /// /// 人脸密码数量 integer(int32) /// public int faceCount; /// /// 指纹密码数量 integer(int32) /// public int fingerCount; /// /// 用户备注名 string /// public string lockRemarkName; /// /// 锁用户类型// 0-主用户,1-普通用户 integer(int32) /// public int lockType; /// /// 门锁用户id string /// public string lockUserIndex; /// /// 用户名 string /// public string lockUserName; /// /// 数字密码数量 integer(int32) /// public int pwdCount; } }