From efad979b6fae76fb37a4de7e94e6bac0a85cb72c Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 30 十一月 2021 13:14:28 +0800 Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。 --- HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs | 355 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 355 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs b/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs new file mode 100644 index 0000000..5689c26 --- /dev/null +++ b/HDL_ON/UI/UI0-Public/Widget/UpdateTipDialog.cs @@ -0,0 +1,355 @@ +锘縰sing System; +using Shared; +using HDL_ON.UI.CSS; + +namespace HDL_ON.UI +{ + /// <summary> + /// UpdateTipDialog + /// </summary> + public class UpdateTipDialog : Dialog + { + + public UpdateTipDialog() + { + } + + /// <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 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; + + 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); + + Button btnTip = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = btnTitle.Bottom, + Height = Application.GetMinRealAverage(17), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = tipStr + }; + contentView.AddChidren(btnTip); + + int btnMesY = btnTip.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); + + TextButton btnMes = new TextButton() + { + //Gravity = Gravity.CenterHorizontal, + Width = mesView.Width, + //Height = mesView.Height, + Height = Application.GetRealWidth(20), + TextAlignment = TextAlignment.TopLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + Text = msgStr, + //BackgroundColor = CSS_Color.AuxiliaryColor2 + + }; + mesView.AddChidren(btnMes); + //鍔ㄦ�佽绠楅珮搴� + var needHeight = btnMes.GetMoreLineNeedHeight(); + if(needHeight < mesView.Height) + { + needHeight = mesView.Height; + } + btnMes.IsMoreLines = true; + btnMes.Height = needHeight; + //mesView.AddChidren(btnMes); + + + Button btnLine = new Button() + { + Y = lineY, + Height = Application.GetRealHeight(1), + Width = contentView.Width, + BackgroundColor = CSS_Color.DividingLineColor, + }; + contentView.AddChidren(btnLine); + + if (!isForceUpdate) + { + 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(45), + 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(45), + 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", + }; + 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() + { + 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) => + { + this.Close(); + 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", + }; + 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 ShowTipDialog(string titleStr, string msgStr, Action okAction) + { + this.ShowTipDialogBase(titleStr, msgStr, okAction); + } + + + + } +} -- Gitblit v1.8.0