From 41f9c8837b0551c68f8fd798c06951fa716b7ab8 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 11 一月 2021 14:05:29 +0800 Subject: [PATCH] Merge branch 'NewFilePath' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into NewFilePath --- HDL_ON/UI/UI0-Public/Widget/ListCellDialog.cs | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 143 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI0-Public/Widget/ListCellDialog.cs b/HDL_ON/UI/UI0-Public/Widget/ListCellDialog.cs new file mode 100644 index 0000000..04cba3e --- /dev/null +++ b/HDL_ON/UI/UI0-Public/Widget/ListCellDialog.cs @@ -0,0 +1,143 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI +{ + public class ListCellDialog + { + /// <summary> + /// 鏁版嵁闆嗗悎 + /// </summary> + Dictionary<string, string> items = new Dictionary<string, string>(); + /// <summary> + /// 褰撳墠閫変腑鐩爣 + /// </summary> + string curItem = ""; + /// <summary> + /// 鍥炴帀鏂规硶 + /// </summary> + Action<string,string> fallbackAction; + + + + public ListCellDialog(Dictionary<string, string> list,string curItem,Action<string,string> fallbackAction) + { + items = list; + this.curItem = curItem; + this.fallbackAction = fallbackAction; + } + + /// <summary> + /// 鍔犺浇鍦ㄥ彸杈圭殑寮圭獥 + /// </summary> + public void ShowRightDialog() + { + + Dialog dialog = new Dialog(); + FrameLayout dialogBodyView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(dialogBodyView); + + int itemCount = 1; + var itemViewHeight = Application.GetRealHeight(73); + switch(items.Count) + { + case 0: + case 1: + itemCount = 1; + itemViewHeight = Application.GetRealHeight(73); + break; + case 2: + itemCount = 2; + itemViewHeight = Application.GetRealHeight(111); + break; + case 3: + itemCount = 3; + itemViewHeight = Application.GetRealHeight(155); + break; + case 4: + itemCount = 4; + itemViewHeight = Application.GetRealHeight(199); + break; + default: + itemCount = 5; + itemViewHeight = Application.GetRealHeight(243); + break; + } + + FrameLayout contentView; + contentView = new FrameLayout() + { + X = Application.GetRealWidth(205), + Y = Application.GetRealHeight(106), + Width = Application.GetRealWidth(160), + Height = itemViewHeight, + BackgroundImagePath = "Public/ListCellbg/ListCellbg" + itemCount.ToString() + ".png", + }; + dialogBodyView.AddChidren(contentView); + + VerticalScrolViewLayout itemsView; + itemsView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(44 * itemCount), + ScrollEnabled = itemCount == 5 + }; + contentView.AddChidren(itemsView); + + bool isFrist = true; + foreach (var item in items) + { + if (isFrist) + { + isFrist = false; + } + else + { + itemsView.AddChidren(new Button() + { + X = Application.GetRealWidth(24), + Width = Application.GetRealWidth(112), + Height = Application.GetRealWidth(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); + } + Button btnItem = new Button() + { + X = Application.GetRealWidth(24), + Width = Application.GetRealWidth(128), + Height = Application.GetRealHeight(44), + Text = item.Value, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + IsSelected = item.Key == curItem + }; + itemsView.AddChidren(btnItem); + + + btnItem.MouseUpEventHandler = (sender, e) => + { + fallbackAction?.Invoke(item.Key, item.Value); + dialog.Close(); + }; + } + dialogBodyView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + dialog.Show(); + + + } + + + } +} -- Gitblit v1.8.0