From 03d8399009aacc15efde15f08e37893e47dc2427 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 07 十二月 2022 10:45:20 +0800 Subject: [PATCH] 大华摄像头,金茂科技系统 --- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 340 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 255 insertions(+), 85 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index cfdd23b..7ed2eea 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -98,110 +98,103 @@ { EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - var dialog = new Dialog(); - var dialogBody = new FrameLayout(); - dialog.AddChidren(dialogBody); - dialogBody.MouseUpEventHandler = (sender1, e1) => + if (UserInfo.Current.regionList.Count < 20) { - dialog.Close(); - }; + var dialog = new Dialog(); + var dialogBody = new FrameLayout(); + dialog.AddChidren(dialogBody); + dialogBody.MouseUpEventHandler = (sender1, e1) => + { + dialog.Close(); + }; - var dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(268), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(110), - BackgroundImagePath = "PersonalCenter/HomeList1bg.png", - }; - dialogBody.AddChidren(dispalyView); - - var contentView = new VerticalScrolViewLayout() - { - X = Application.GetRealWidth(22), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(45), - ScrollEnabled = false - }; - dispalyView.AddChidren(contentView); - - if (UserInfo.Current.regionList.Count < 2) - { - - } - else if (UserInfo.Current.regionList.Count < 3) - { - dispalyView = new FrameLayout() + var dispalyView = new FrameLayout() { X = Application.GetRealWidth(10), Y = Application.GetRealHeight(268), Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(105), + Height = Application.GetRealHeight(110), BackgroundImagePath = "PersonalCenter/HomeList1bg.png", }; dialogBody.AddChidren(dispalyView); - contentView.Height = Application.GetRealHeight(45 * 2); - dispalyView.AddChidren(contentView); - } - else if (UserInfo.Current.regionList.Count < 4) - { - dispalyView = new FrameLayout() + var contentView = new VerticalScrolViewLayout() { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(268), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(155), - BackgroundImagePath = "PersonalCenter/HomeList2bg.png", + X = Application.GetRealWidth(22), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(45), + ScrollEnabled = false }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 3); dispalyView.AddChidren(contentView); - } - else if (UserInfo.Current.regionList.Count < 5) - { - dispalyView = new FrameLayout() + + if (UserInfo.Current.regionList.Count < 2) { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(268), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(200), - BackgroundImagePath = "PersonalCenter/HomeList3bg.png", - }; - dialogBody.AddChidren(dispalyView); - contentView.Height = Application.GetRealHeight(45 * 4); - dispalyView.AddChidren(contentView); - } - else - { - dispalyView = new FrameLayout() + } + else if (UserInfo.Current.regionList.Count < 3) { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(268), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(245), - BackgroundImagePath = "PersonalCenter/HomeList4bg.png", - }; - dialogBody.AddChidren(dispalyView); + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(105), + BackgroundImagePath = "PersonalCenter/HomeList1bg.png", + }; + dialogBody.AddChidren(dispalyView); - contentView.Height = Application.GetRealHeight(45 * 5); - contentView.ScrollEnabled = true; - dispalyView.AddChidren(contentView); - } + contentView.Height = Application.GetRealHeight(45 * 2); + dispalyView.AddChidren(contentView); + } + else if (UserInfo.Current.regionList.Count < 4) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(155), + BackgroundImagePath = "PersonalCenter/HomeList2bg.png", + }; + dialogBody.AddChidren(dispalyView); - int iii = 0; - //while(iii<20) - { + contentView.Height = Application.GetRealHeight(45 * 3); + dispalyView.AddChidren(contentView); + } + else if (UserInfo.Current.regionList.Count < 5) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(200), + BackgroundImagePath = "PersonalCenter/HomeList3bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 4); + dispalyView.AddChidren(contentView); + } + else + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(268), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(245), + BackgroundImagePath = "PersonalCenter/HomeList4bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 5); + contentView.ScrollEnabled = true; + dispalyView.AddChidren(contentView); + } foreach (var home in UserInfo.Current.regionList) { - if (iii > 100) - { - break; - } - iii++; var btnHomeName = new Button() { Width = Application.GetRealWidth(112), @@ -235,14 +228,191 @@ LoadContentView(); }; } + dialog.Show(); } - dialog.Show(); + else + { + List<RegionInfoRes> newlist = UserInfo.Current.regionList; + int pageIndex = 0; + int pageCount = UserInfo.Current.regionList.Count / 6 + 1; + var dialog = new Dialog(); + var dialogBody = new FrameLayout(); + dialog.AddChidren(dialogBody); + dialogBody.MouseUpEventHandler = (sender1, e1) => + { + dialog.Close(); + }; + + var dispalyView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(267), + Height = Application.GetRealHeight(667- 267 + 20), + Radius = (uint)Application.GetRealWidth(16), + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + }; + dialogBody.AddChidren(dispalyView); + + #region 鎼滅储鏍� + FrameLayout searchView = new FrameLayout() + { + Height = Application.GetRealHeight(50), + }; + dispalyView.AddChidren(searchView); + + var searchTv = new EditText() + { + X = Application.GetRealWidth(16), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(330), + Height = Application.GetRealHeight(38), + BorderColor = CSS.CSS_Color.DividingLineColor, + BorderWidth = 3, + TextColor = CSS.CSS_Color.TextualColor, + }; + searchView.AddChidren(searchTv); + + + #endregion + + #region 鍒楄〃 + var showListView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(50), + Height = Application.GetRealHeight(667 - 267 - 100), + ScrollEnabled = false, + }; + dispalyView.AddChidren(showListView); + + ChangeShowHomeList(pageIndex, dialog, showListView,newlist); + + #endregion + + #region 涓婁笅椤� + var bottomOptionView = new FrameLayout() + { + Y = Application.GetRealHeight(667 - 268 - 50), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS.CSS_Color.DividingLineColor + }; + dispalyView.AddChidren(bottomOptionView); + + var btnPre = new Button() + { + Y = 1, + Width = Application.GetRealWidth(374 / 2), + Height = Application.GetRealHeight(50) - 1, + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + Text = "涓婁竴椤�", + TextAlignment = TextAlignment.Center, + TextColor = CSS.CSS_Color.TextualColor, + TextSize = CSS.CSS_FontSize.TextFontSize, + }; + bottomOptionView.AddChidren(btnPre); + btnPre.MouseUpEventHandler = (sender, e) => { + if (pageIndex < 1) + { + return; + } + pageIndex--; + ChangeShowHomeList(pageIndex, dialog, showListView, newlist); + }; + + var btnNext = new Button() + { + Y = 1, + X = Application.GetRealWidth(374 / 2)+1, + Width = Application.GetRealWidth(374 / 2), + Height = Application.GetRealHeight(50) - 1, + BackgroundColor = CSS.CSS_Color.MainBackgroundColor, + Text = "涓嬩竴椤�", + TextAlignment = TextAlignment.Center, + TextColor = CSS.CSS_Color.TextualColor, + TextSize = CSS.CSS_FontSize.TextFontSize, + }; + bottomOptionView.AddChidren(btnNext); + btnNext.MouseUpEventHandler = (sender, e) => { + pageIndex++; + if (pageIndex > pageCount-1) + { + return; + } + ChangeShowHomeList(pageIndex, dialog, showListView,newlist); + }; + + #endregion + + + searchTv.TextChangeEventHandler = (sender, e) => { + new System.Threading.Thread(() => { + newlist = UserInfo.Current.regionList.FindAll((obj) => obj.homeName.Contains(e)); + pageCount = newlist.Count; + pageIndex = 0; + Application.RunOnMainThread(() => { + ChangeShowHomeList(pageIndex, dialog, showListView, newlist); + }); + }).Start(); + }; + + dialog.Show(); + } }; btnResidenceDownIcon.MouseUpEventHandler = eventHandler; btnCurResidenceName.MouseUpEventHandler = eventHandler; } /// <summary> + /// 鍒囨崲浣忓畢鍒楄〃鏄剧ず + /// </summary> + void ChangeShowHomeList(int pageIndex,Dialog dialog, VerticalScrolViewLayout showListView, List<RegionInfoRes> newlist) + { + if(newlist.Count == 0) + { + return; + } + showListView.RemoveAll(); + for (int i = 0; i < 6; i++) + { + if ((i + pageIndex * 6) >= newlist.Count) + { + return; + } + var home = newlist[i + pageIndex * 6]; + var btnHomeName = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(50) - 1, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS.CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS.CSS_Color.MainColor, + Text = home.homeName, + TextSize = home.homeName.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize, + IsSelected = DB_ResidenceData.Instance.CurrentRegion.id == home.id, + IsMoreLines = true, + Tag = home.id + }; + showListView.AddChidren(btnHomeName); + + showListView.AddChidren(new Button() + { + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.BackgroundColor + }); + + btnHomeName.MouseUpEventHandler += (senderH, en) => + { + var regionId = (string)btnHomeName.Tag; + dialog.Close(); + LoadEvent_ChangeCurHome(home); + LoadContentView(); + }; + } + + + } + + /// <summary> /// 鏇存崲褰撳墠閫変腑浣忓畢 /// </summary> /// <param name="homeTemp"></param> -- Gitblit v1.8.0