From cbc156bc38d8b8eae7aef60cb186ab2b52fa701f Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 16 七月 2024 13:59:56 +0800 Subject: [PATCH] 增加全部挂断 --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserListPage.cs | 129 +++++++++++++++++++++++++++--------------- 1 files changed, 83 insertions(+), 46 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserListPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserListPage.cs index c8d91ad..136a003 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserListPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockUserListPage.cs @@ -11,13 +11,17 @@ public class VideoDoorlockUserListPage : FrameLayout { FrameLayout bodyView; + VerticalScrolViewLayout contentView; Function device; + + List<VideoDoorlockUser> userList; public VideoDoorlockUserListPage(Function function) { bodyView = this; device = function; + userList = new List<VideoDoorlockUser>(); } public void LoadPage() @@ -26,12 +30,27 @@ bodyView.BackgroundColor = CSS_Color.BackgroundColor; - var contentView = new VerticalScrolViewLayout() + + contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667 - 70), + 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); @@ -45,52 +64,11 @@ { if (pack.Code == StateCode.SUCCESS) { - var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<VideoDoorlockUser>>(pack.Data.ToString()); - if (list != null) + userList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<VideoDoorlockUser>>(pack.Data.ToString()); + if (userList != null) { Application.RunOnMainThread(() => { - foreach (var user in list) - { - 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); - MainPage.BasePageView.AddChidren(page); - page.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - } + initView(); }); } } @@ -120,6 +98,65 @@ } + + 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 -- Gitblit v1.8.0