From 0f8f6ad183a9595a82f3229029b16cbcf62bf8ff Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 27 十一月 2020 13:35:31 +0800 Subject: [PATCH] 2020-11-27 1.更新 --- HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs | 297 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 216 insertions(+), 81 deletions(-) diff --git a/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs b/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs index 9e105c3..fb23965 100644 --- a/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs +++ b/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs @@ -1,7 +1,6 @@ 锘縰sing System; using Shared; using HDL_ON.UI.CSS; -using System.Collections.Generic; namespace HDL_ON.UI { @@ -25,7 +24,7 @@ /// <param name="cancelAction"></param> /// <param name="cancelID"></param> /// <param name="confirmID"></param> - void ShowDialogBase(string titleStr, string tipStr, List<string> msgList, Action okAction, Action cancelAction, int cancelID = StringId.Ignore, int confirmID = StringId.Update) + void ShowDialogBase(string titleStr, string tipStr, string msgStr, Action okAction, Action cancelAction, bool isForceUpdate, int cancelID = StringId.Ignore, int confirmID = StringId.Update) { this.BackgroundColor = CSS_Color.DialogTransparentColor1; @@ -66,35 +65,32 @@ }; contentView.AddChidren(btnTip); - //鏂规1 - int listViewY = btnTip.Bottom + Application.GetMinRealAverage(10); - int lineY = Application.GetRealHeight(250); + int btnMesY = btnTip.Bottom + Application.GetMinRealAverage(5); + int lineY = Application.GetRealHeight(258); - var listView = new VerticalScrolViewLayout() + VerticalScrolViewLayout mesView = new VerticalScrolViewLayout() { - X = Application.GetRealWidth(25), - Width = contentView.Width - Application.GetRealWidth(50), - Y = listViewY, - Height = lineY - listViewY, + X = Application.GetRealWidth(16), + Y = btnMesY, + Width = contentView.Width - Application.GetRealWidth(32), + Height = lineY - btnMesY - Application.GetMinRealAverage(5), }; - contentView.AddChidren(listView); + contentView.AddChidren(mesView); - //鏂规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, + Button btnMes = new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = mesView.Width, + Height = mesView.Height, + TextAlignment = TextAlignment.TopLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + IsMoreLines = true, + Text = msgStr, + //BackgroundColor = CSS_Color.AuxiliaryColor2 - //}; - //listView.AddChidren(btnMes); + }; + mesView.AddChidren(btnMes); Button btnLine = new Button() { @@ -105,23 +101,198 @@ }; contentView.AddChidren(btnLine); - Button btnCancel = new Button() + if (!isForceUpdate) { - Y = btnLine.Bottom, - Width = Application.GetRealWidth(144), - Height = Application.GetRealHeight(44), - TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.TextualColor, - TextSize = CSS_FontSize.SubheadingFontSize, - TextID = cancelID, + int Width144 = Application.GetRealWidth(144); + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Width144, + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = cancelID, + }; + contentView.AddChidren(btnCancel); + + Button btnConfirm = new Button() + { + X = contentView.Width - Width144, + Y = btnLine.Y, + Width = Width144, + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + BackgroundColor = CSS_Color.MainColor, + TextID = confirmID, + }; + contentView.AddChidren(btnConfirm); + //渚嬶細鍙充笅鍦嗚 澶у皬涓�50 + int mRectCornerID = HDLUtils.RectCornerBottomRight; + btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), mRectCornerID); + + btnCancel.MouseUpEventHandler += (sender, e) => + { + this.Close(); + cancelAction?.Invoke(); + }; + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + this.Close(); + okAction?.Invoke(); + }; + } + else + { + Button btnConfirm = new Button() + { + Y = btnLine.Y, + Width = contentView.Width, + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + BackgroundColor = CSS_Color.MainColor, + TextID = confirmID, + }; + contentView.AddChidren(btnConfirm); + //渚嬶細鍙充笅鍦嗚 澶у皬涓�50 + int mRectCornerID = HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerBottomLeft; + btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), mRectCornerID); + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + //dialog绂佹鍏抽棴 + okAction?.Invoke(); + }; + } + + Button btnHeadImage = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetMinRealAverage(152), + Width = Application.GetMinRealAverage(160), + Height = Application.GetMinRealAverage(160), + BorderColor = 0x00000000, + BorderWidth = 0, + UnSelectedImagePath = "Public/Dialog/DialogTipTitleIcon_3.png", }; - contentView.AddChidren(btnCancel); + this.AddChidren(btnHeadImage); + + 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 ShowUpdateDialog(string titleStr, string tipStr, string msgStr, Action okAction, Action cancelAction = null) + { + this.ShowDialogBase(titleStr, tipStr, msgStr, okAction, cancelAction, false); + } + + /// <summary> + /// 鍔犺浇寮哄埗鏇存柊Dialog + /// Dialog涓嶅叧闂� + /// </summary> + /// <param name="titleStr"></param> + /// <param name="tipStr"></param> + /// <param name="msgStr"></param> + /// <param name="okAction"></param> + /// <param name="cancelAction"></param> + public void ShowForcedUpdateDialog(string titleStr, string tipStr, string msgStr, Action okAction) + { + this.ShowDialogBase(titleStr, tipStr, msgStr, okAction, null, true); + } + + /// <summary> + /// 鍒濆鍖朌ialog + /// </summary> + /// <param name="titleStr"></param> + /// <param name="tipStr"></param> + /// <param name="msgStr"></param> + /// <param name="okAction"></param> + /// <param name="cancelAction"></param> + /// <param name="cancelID"></param> + /// <param name="confirmID"></param> + void ShowTipDialogBase(string titleStr, string msgStr, Action okAction, int confirmID = StringId.Close) + { + this.BackgroundColor = CSS_Color.DialogTransparentColor1; + + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetMinRealAverage(223), + Width = Application.GetRealWidth(288), + Height = Application.GetRealHeight(302), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + BorderWidth = 0, + BorderColor = 0x00000000, + }; + this.AddChidren(contentView); + + Button btnTitle = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetMinRealAverage(95), + Height = Application.GetMinRealAverage(30), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.EmphasisFontSize_Secondary, + Text = titleStr + }; + contentView.AddChidren(btnTitle); + + int btnMesY = btnTitle.Bottom + Application.GetMinRealAverage(5); + int lineY = Application.GetRealHeight(258); + + VerticalScrolViewLayout mesView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(16), + Y = btnMesY, + Width = contentView.Width - Application.GetRealWidth(32), + Height = lineY - btnMesY - Application.GetMinRealAverage(5), + }; + contentView.AddChidren(mesView); + + Button btnMes = new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = mesView.Width, + Height = mesView.Height, + TextAlignment = TextAlignment.TopLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + IsMoreLines = true, + Text = msgStr, + BackgroundColor = CSS_Color.AuxiliaryColor2 + + }; + mesView.AddChidren(btnMes); + + Button btnLine = new Button() + { + Y = lineY, + Height = Application.GetRealHeight(1), + Width = contentView.Width, + BackgroundColor = CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + Button btnConfirm = new Button() { - X = btnCancel.Right, Y = btnLine.Y, - Width = Application.GetRealWidth(144), + Width = contentView.Width, Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.SubheadingFontSize, @@ -131,14 +302,8 @@ }; contentView.AddChidren(btnConfirm); //渚嬶細鍙充笅鍦嗚 澶у皬涓�50 - int mRectCornerID = HDLUtils.RectCornerBottomRight; + int mRectCornerID = HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerBottomLeft; btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), mRectCornerID); - - btnCancel.MouseUpEventHandler += (sender, e) => - { - this.Close(); - cancelAction?.Invoke(); - }; btnConfirm.MouseUpEventHandler += (sender, e) => { @@ -158,53 +323,23 @@ }; 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 + /// 鍔犺浇鎻愮ず閫氱煡Dialog /// </summary> /// <param name="titleStr"></param> /// <param name="tipStr"></param> - /// <param name="msgList"></param> + /// <param name="msgStr"></param> /// <param name="okAction"></param> /// <param name="cancelAction"></param> - public void ShowDialog(string titleStr, string tipStr, List<string> msgList, Action okAction, Action cancelAction = null) + public void ShowTipDialog(string titleStr, string msgStr, Action okAction) { - this.ShowDialogBase(titleStr, tipStr, msgList, okAction, cancelAction); + this.ShowTipDialogBase(titleStr, msgStr, okAction); } + + + } } -- Gitblit v1.8.0