using System;
|
using Shared;
|
using HDL_ON.UI.CSS;
|
using System.Collections.Generic;
|
|
namespace HDL_ON.UI
|
{
|
/// <summary>
|
/// 更新二次确认界面
|
/// 可以自定义按钮文字
|
/// </summary>
|
public class UpdateTipDialog : Dialog
|
{
|
|
public UpdateTipDialog()
|
{
|
}
|
|
/// <summary>
|
/// 初始化Dialog
|
/// </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, List<string> msgList, Action okAction, Action cancelAction, 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);
|
|
//方案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(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 = lineY,
|
Height = Application.GetRealHeight(1),
|
Width = contentView.Width,
|
BackgroundColor = CSS_Color.DividingLineColor,
|
};
|
contentView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(144),
|
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 = btnCancel.Right,
|
Y = btnLine.Y,
|
Width = Application.GetRealWidth(144),
|
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();
|
};
|
|
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);
|
|
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="msgList"></param>
|
/// <param name="okAction"></param>
|
/// <param name="cancelAction"></param>
|
public void ShowDialog(string titleStr, string tipStr, List<string> msgList, Action okAction, Action cancelAction = null)
|
{
|
this.ShowDialogBase(titleStr, tipStr, msgList, okAction, cancelAction);
|
}
|
}
|
}
|