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 btnImage;
|
/// <summary>
|
///
|
/// </summary>
|
public LineView lineView;
|
|
/// <summary>
|
///
|
/// </summary>
|
public string tilteText;
|
/// <summary>
|
///
|
/// </summary>
|
public string subtitleText;
|
|
/// <summary>
|
/// 点击触发对事件
|
/// </summary>
|
public Action goAction;
|
|
/// <summary>
|
///
|
/// </summary>
|
public bool isShowImageBtn = true;
|
|
|
/// <summary>
|
///
|
/// </summary>
|
public ListCellView()
|
{
|
this.Height = Application.GetRealHeight(50);
|
this.BackgroundColor = CSS_Color.MainBackgroundColor;
|
ShowView();
|
}
|
|
/// <summary>
|
///
|
/// </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)
|
{
|
this.Height = Application.GetRealHeight(50);
|
this.tilteText = tilteText;
|
this.subtitleText = subtitleText;
|
this.goAction = action;
|
ShowView();
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
void ShowView()
|
{
|
/// <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>
|
btnImage = 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(btnImage);
|
}
|
|
lineView = new LineView();
|
this.AddChidren(lineView);
|
lineView.Y = this.Height - lineView.Height;
|
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
|
{
|
goAction?.Invoke();
|
};
|
btnTilte.MouseUpEventHandler = eventHandler;
|
btnSubtitle.MouseUpEventHandler = eventHandler;
|
btnImage.MouseUpEventHandler = eventHandler;
|
|
}
|
}
|
}
|