wxr
2021-05-12 9acd3887f1f8db40d59f991b1726a61aa7c7637c
HDL_ON/UI/UI0-Public/Widget/ListIconCellView.cs
New file
@@ -0,0 +1,100 @@
using System;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 通用ListIconCellView
    /// 支持定义 图标、主标题、go图标、下划线、点击事件
    /// </summary>
    public class ListIconCellView : FrameLayout
    {
        /// <summary>
        /// 图标按钮
        /// </summary>
        public Button BtnIcon;
        /// <summary>
        /// 标题
        /// </summary>
        public Button BtnTilte;
        /// <summary>
        /// 箭头图标按钮
        /// </summary>
        public Button BtnGo;
        /// <summary>
        /// 分割线
        /// </summary>
        public LineView LineView;
        /// <summary>
        /// 点击触发对事件
        /// </summary>
        public Action GoAction;
        /// <summary>
        ///
        /// </summary>
        public ListIconCellView()
        {
            ShowView();
        }
        /// <summary>
        ///
        /// </summary>
        void ShowView()
        {
            this.Height = Application.GetRealHeight(50);
            this.BackgroundColor = CSS_Color.MainBackgroundColor;
            BtnIcon = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                Gravity = Gravity.CenterVertical,
            };
            this.AddChidren(BtnIcon);
            /// <summary>
            /// 标题
            /// </summary>
            BtnTilte = new Button()
            {
                X = Application.GetRealWidth(52),
                Width = Application.GetRealWidth(278),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
            this.AddChidren(BtnTilte);
            /// <summary>
            /// 前进图标
            /// </summary>
            BtnGo = new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            this.AddChidren(BtnGo);
            LineView = new LineView(this.Height);
            this.AddChidren(LineView);
            //LineView.Y = this.Height - LineView.Height;
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                GoAction?.Invoke();
            };
            BtnTilte.MouseUpEventHandler = eventHandler;
            BtnGo.MouseUpEventHandler = eventHandler;
        }
    }
}