JLChen
2020-12-09 e87985ec1dcb69beedaf9f95e8e7aba14b7c08d6
HDL_ON/UI/UI0-Public/Widget/ListCellView.cs
@@ -11,50 +11,46 @@
    public class ListCellView : FrameLayout
    {
        /// <summary>
        ///
        /// 标题
        /// </summary>
        public Button btnTilte;
        public Button BtnTilte;
        /// <summary>
        /// 副标题
        /// </summary>
        public Button btnSubtitle;
        public Button BtnSubtitle;
        /// <summary>
        /// 箭头图标
        /// </summary>
        public Button btnImage;
        public Button BtnGo;
        /// <summary>
        ///
        /// 分割线
        /// </summary>
        public LineView lineView;
        /// <summary>
        ///
        /// </summary>
        public string tilteText;
        /// <summary>
        ///
        /// </summary>
        public string subtitleText;
        public LineView LineView;
        /// <summary>
        /// 点击触发对事件
        /// </summary>
        public Action goAction;
        /// <summary>
        ///
        /// </summary>
        public bool isShowImageBtn = true;
        public Action GoAction;
        /// <summary>
        ///
        /// ListCellView 默认
        /// </summary>
        public ListCellView()
        {
            this.Height = Application.GetRealHeight(50);
            this.BackgroundColor = CSS_Color.MainBackgroundColor;
            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>
@@ -64,24 +60,15 @@
        /// <param name="subtitleText"></param>
        /// <param name="action"></param>
        /// <param name="isShowImageBtn"></param>
        public ListCellView(string tilteText, string subtitleText, Action action, bool isShowImageBtn = true)
        void ShowView(string tilteText = "", string subtitleText = "", Action action = null, bool isShowImageBtn = true)
        {
            this.BackgroundColor = CSS_Color.MainBackgroundColor;
            this.Height = Application.GetRealHeight(50);
            this.tilteText = tilteText;
            this.subtitleText = subtitleText;
            this.goAction = action;
            ShowView();
        }
        /// <summary>
        ///
        /// </summary>
        void ShowView()
        {
            this.GoAction = action;
            /// <summary>
            /// 标题
            /// </summary>
            btnTilte = new Button()
            BtnTilte = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(120),
@@ -90,11 +77,11 @@
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = tilteText,
            };
            this.AddChidren(btnTilte);
            this.AddChidren(BtnTilte);
            /// <summary>
            /// 副标题
            /// </summary>
            btnSubtitle = new Button()
            BtnSubtitle = new Button()
            {
                X = Application.GetRealWidth(100),
                Width = Application.GetRealWidth(230),
@@ -104,12 +91,12 @@
                Text = subtitleText,
            };
            this.AddChidren(btnSubtitle);
            this.AddChidren(BtnSubtitle);
            /// <summary>
            /// 前进图标
            /// </summary>
            btnImage = new Button()
            BtnGo = new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
@@ -120,20 +107,19 @@
            if (isShowImageBtn)
            {
                this.AddChidren(btnImage);
                this.AddChidren(BtnGo);
            }
            lineView = new LineView();
            this.AddChidren(lineView);
            lineView.Y = this.Height - lineView.Height;
            LineView = new LineView(this.Height);
            this.AddChidren(LineView);
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                goAction?.Invoke();
                GoAction?.Invoke();
            };
            btnTilte.MouseUpEventHandler = eventHandler;
            btnSubtitle.MouseUpEventHandler = eventHandler;
            btnImage.MouseUpEventHandler = eventHandler;
            BtnTilte.MouseUpEventHandler = eventHandler;
            BtnSubtitle.MouseUpEventHandler = eventHandler;
            BtnGo.MouseUpEventHandler = eventHandler;
        }
    }