New file |
| | |
| | | using System; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | /// <summary> |
| | | /// 通用ListCellView |
| | | /// 支持定义 主标题、副标题、go图标、下划线、点击事件 |
| | | /// </summary> |
| | | public class ListCellView : FrameLayout |
| | | { |
| | | /// <summary> |
| | | /// 标题 |
| | | /// </summary> |
| | | public Button BtnTilte; |
| | | /// <summary> |
| | | /// 副标题 |
| | | /// </summary> |
| | | public Button BtnSubtitle; |
| | | /// <summary> |
| | | /// 箭头图标 |
| | | /// </summary> |
| | | public Button BtnGo; |
| | | /// <summary> |
| | | /// 分割线 |
| | | /// </summary> |
| | | public LineView LineView; |
| | | /// <summary> |
| | | /// 点击触发对事件 |
| | | /// </summary> |
| | | public Action GoAction; |
| | | |
| | | |
| | | /// <summary> |
| | | /// ListCellView 默认 |
| | | /// </summary> |
| | | public ListCellView() |
| | | { |
| | | ShowView(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ListCellView 指定参数 |
| | | /// </summary> |
| | | /// <param name="tilteText"></param> |
| | | /// <param name="subtitleText"></param> |
| | | /// <param name="action"></param> |
| | | /// <param name="isShowImageBtn"></param> |
| | | public ListCellView(string tilteText, string subtitleText, Action action, bool isShowImageBtn = true) |
| | | { |
| | | |
| | | ShowView(tilteText, subtitleText, action, isShowImageBtn); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="tilteText"></param> |
| | | /// <param name="subtitleText"></param> |
| | | /// <param name="action"></param> |
| | | /// <param name="isShowImageBtn"></param> |
| | | void ShowView(string tilteText = "", string subtitleText = "", Action action = null, bool isShowImageBtn = true) |
| | | { |
| | | this.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.Height = Application.GetRealHeight(50); |
| | | this.GoAction = action; |
| | | /// <summary> |
| | | /// 标题 |
| | | /// </summary> |
| | | BtnTilte = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(120), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | Text = tilteText, |
| | | }; |
| | | this.AddChidren(BtnTilte); |
| | | /// <summary> |
| | | /// 副标题 |
| | | /// </summary> |
| | | BtnSubtitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(100), |
| | | Width = Application.GetRealWidth(230), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = subtitleText, |
| | | |
| | | }; |
| | | this.AddChidren(BtnSubtitle); |
| | | |
| | | /// <summary> |
| | | /// 前进图标 |
| | | /// </summary> |
| | | BtnGo = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | |
| | | if (isShowImageBtn) |
| | | { |
| | | this.AddChidren(BtnGo); |
| | | } |
| | | |
| | | LineView = new LineView(this.Height); |
| | | this.AddChidren(LineView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | GoAction?.Invoke(); |
| | | }; |
| | | BtnTilte.MouseUpEventHandler = eventHandler; |
| | | BtnSubtitle.MouseUpEventHandler = eventHandler; |
| | | BtnGo.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | } |
| | | } |