From 7ff70bc7c9460c395b59952d55df6e5d6a12a718 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 二月 2023 16:27:32 +0800 Subject: [PATCH] Merge branch 'Dev-Wxr' --- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 388 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 287 insertions(+), 101 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 910b0dd..f485677 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -98,144 +98,330 @@ { 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 if (UserInfo.Current.regionList.Count < 3) + { + 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 * 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); + + 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) + { + var btnHomeName = new Button() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(40), + 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 + }; + contentView.AddChidren(btnHomeName); + + if (UserInfo.Current.regionList.IndexOf(home) < UserInfo.Current.regionList.Count - 1) + { + contentView.AddChidren(new Button() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS.CSS_Color.BackgroundColor + }); + } + + btnHomeName.MouseUpEventHandler += (senderH, en) => + { + var regionId = (string)btnHomeName.Tag; + dialog.Close(); + LoadEvent_ChangeCurHome(home); + LoadContentView(); + }; + } + dialog.Show(); } else { - dispalyView = new FrameLayout() + 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) => { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(268), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(245), - BackgroundImagePath = "PersonalCenter/HomeList4bg.png", + 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); - contentView.Height = Application.GetRealHeight(45 * 5); - contentView.ScrollEnabled = true; - dispalyView.AddChidren(contentView); - } - - - - foreach (var home in UserInfo.Current.regionList) - { - var btnHomeName = new Button() + #region 鎼滅储鏍� + FrameLayout searchView = new FrameLayout() { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(40), - 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 + Height = Application.GetRealHeight(50), }; - contentView.AddChidren(btnHomeName); + dispalyView.AddChidren(searchView); - if (UserInfo.Current.regionList.IndexOf(home) < UserInfo.Current.regionList.Count - 1) + var searchTv = new EditText() { - contentView.AddChidren(new Button() + 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, + }; + if(Language.CurrentLanguage != "Chinese") + { + btnPre.Text = "Previous"; + } + bottomOptionView.AddChidren(btnPre); + btnPre.MouseUpEventHandler = (sender33, e33) => { + if (pageIndex < 1) { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS.CSS_Color.BackgroundColor - }); + 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, + }; + if(Language.CurrentLanguage != "Chinese") + { + btnNext.Text = "Next"; } - btnHomeName.MouseUpEventHandler += (senderH, en) => - { - var regionId = (string)btnHomeName.Tag; - dialog.Close(); - LoadEvent_ChangeCurHome(home); - LoadContentView(); + bottomOptionView.AddChidren(btnNext); + btnNext.MouseUpEventHandler = (sender33, e33) => { + pageIndex++; + if (pageIndex > pageCount-1) + { + return; + } + ChangeShowHomeList(pageIndex, dialog, showListView,newlist); }; + + #endregion + + + searchTv.TextChangeEventHandler = (sender33, e33) => { + new System.Threading.Thread(() => { + newlist = UserInfo.Current.regionList.FindAll((obj) => obj.homeName.Contains(e33)); + pageCount = newlist.Count; + pageIndex = 0; + Application.RunOnMainThread(() => { + ChangeShowHomeList(pageIndex, dialog, showListView, newlist); + }); + }).Start(); + }; + + dialog.Show(); } - 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