JLChen
2020-11-24 25bb055b0249d86548883083bb315922e6a2076b
HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs
File was renamed from HDL_ON/UI/UI0-Public/Widget/TipDialog.cs
@@ -1,17 +1,18 @@
using System;
using Shared;
using HDL_ON.UI.CSS;
using System.Collections.Generic;
namespace HDL_ON.UI
{
    /// <summary>
    /// 通用二次确认界面
    /// 更新二次确认界面
    /// 可以自定义按钮文字
    /// </summary>
    public class TipDialog : Dialog
    public class UpdateTipDialog : Dialog
    {
        public TipDialog()
        public UpdateTipDialog()
        {
        }
@@ -25,7 +26,7 @@
        /// <param name="cancelAction"></param>
        /// <param name="cancelID"></param>
        /// <param name="confirmID"></param>
        void ShowDialogBase(string titleStr, string tipStr, string msgStr, Action okAction, Action cancelAction, int cancelID = StringId.Ignore, int confirmID = StringId.Update)
        void ShowDialogBase(string titleStr, string tipStr, List<string> msgList, Action okAction, Action cancelAction, int cancelID = StringId.Ignore, int confirmID = StringId.Update)
        {
            this.BackgroundColor = CSS_Color.DialogTransparentColor1;
@@ -42,7 +43,7 @@
            };
            this.AddChidren(contentView);
            Button btnTipRegisterSuccess = new Button()
            Button btnTitle = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetMinRealAverage(95),
@@ -52,12 +53,12 @@
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                Text = titleStr
            };
            contentView.AddChidren(btnTipRegisterSuccess);
            contentView.AddChidren(btnTitle);
            Button btnTip = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = btnTipRegisterSuccess.Bottom,
                Y = btnTitle.Bottom,
                Height = Application.GetMinRealAverage(17),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.PromptingColor1,
@@ -66,25 +67,39 @@
            };
            contentView.AddChidren(btnTip);
            Button btnMes = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                X = Application.GetRealWidth(25),
                Y = btnTip.Bottom + Application.GetMinRealAverage(28),
                Width = contentView.Width - Application.GetRealWidth(50),
                Height = Application.GetRealHeight(80),
                TextAlignment = TextAlignment.TopLeft,
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.TextFontSize,
                IsMoreLines = true,
                Text = msgStr,
            //方案1
            int listViewY = btnTip.Bottom + Application.GetMinRealAverage(10);
            int lineY = Application.GetRealHeight(250);
            var listView = new VerticalScrolViewLayout()
            {
                X = Application.GetRealWidth(25),
                Width = contentView.Width - Application.GetRealWidth(50),
                Y = listViewY,
                Height = lineY - listViewY,
            };
            contentView.AddChidren(btnMes);
            contentView.AddChidren(listView);
            //方案2
            //Button btnMes = new Button()
            //{
            //    Gravity = Gravity.CenterHorizontal,
            //    X = Application.GetRealWidth(25),
            //    Y = btnTip.Bottom + Application.GetMinRealAverage(28),
            //    Width = contentView.Width - Application.GetRealWidth(50),
            //    Height = lineY - listViewY,
            //    TextAlignment = TextAlignment.TopLeft,
            //    TextColor = CSS_Color.TextualColor,
            //    TextSize = CSS_FontSize.TextFontSize,
            //    IsMoreLines = true,
            //    Text = msgStr,
            //};
            //listView.AddChidren(btnMes);
            Button btnLine = new Button()
            {
                Y = Application.GetRealHeight(258),
                Y = lineY,
                Height = Application.GetRealHeight(1),
                Width = contentView.Width,
                BackgroundColor = CSS_Color.DividingLineColor,
@@ -144,22 +159,53 @@
            };
            this.AddChidren(btnHeadImage);
            if(msgList != null && msgList.Count > 0)
            {
                foreach(var mes in msgList)
                {
                    Button btnMes = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = listView.Width,
                        Height = Application.GetRealHeight(17),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextColor = CSS_Color.TextualColor,
                        TextSize = CSS_FontSize.TextFontSize,
                        Text = mes,
                    };
                    contentView.AddChidren(btnMes);
                }
            }
            this.Show();
        }
        ///// <summary>
        ///// 加载提示Dialog
        ///// </summary>
        ///// <param name="titleStr"></param>
        ///// <param name="tipStr"></param>
        ///// <param name="msgStr"></param>
        ///// <param name="okAction"></param>
        ///// <param name="cancelAction"></param>
        //public void ShowDialog(string titleStr, string tipStr, string msgStr, Action okAction, Action cancelAction = null)
        //{
        //    this.ShowDialogBase(titleStr, tipStr, msgStr, okAction, cancelAction);
        //}
        /// <summary>
        /// 加载提示Dialog
        /// </summary>
        /// <param name="titleStr"></param>
        /// <param name="tipStr"></param>
        /// <param name="msgStr"></param>
        /// <param name="msgList"></param>
        /// <param name="okAction"></param>
        /// <param name="cancelAction"></param>
        public void ShowDialog(string titleStr, string tipStr, string msgStr, Action okAction, Action cancelAction = null)
        public void ShowDialog(string titleStr, string tipStr, List<string> msgList, Action okAction, Action cancelAction = null)
        {
            this.ShowDialogBase(titleStr, tipStr, msgStr, okAction, cancelAction);
            this.ShowDialogBase(titleStr, tipStr, msgList, okAction, cancelAction);
        }
    }
}