File was renamed from HDL_ON/UI/UI0-Public/ConfirmDialog.cs |
| | |
| | | { |
| | | /// <summary> |
| | | /// 通用二次确认界面 |
| | | /// 可以自定义按钮文字 |
| | | /// 可以自定义按钮文字、提示内容支持多行显示 |
| | | /// </summary> |
| | | public class ConfirmDialog : Dialog |
| | | { |
| | |
| | | /// </summary> |
| | | public ConfirmDialog() |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化Dialog |
| | | /// </summary> |
| | | /// <param name="titleId"></param> |
| | | /// <param name="msgId"></param> |
| | | /// <param name="titleStr"></param> |
| | | /// <param name="msgStr"></param> |
| | | /// <param name="okAction"></param> |
| | | /// <param name="cancelAction"></param> |
| | | /// <param name="cancelID"></param> |
| | | /// <param name="confirmID"></param> |
| | | void ShowDialogBase(int titleId, int msgId, Action okAction, Action cancelAction, int cancelID = StringId.Cancel, int confirmID = StringId.Confirm) |
| | | void ShowDialogBase(string titleStr, string msgStr, Action okAction, Action cancelAction, int cancelID = StringId.Cancel, int confirmID = StringId.Confirm) |
| | | { |
| | | |
| | | this.BackgroundColor = CSS_Color.DialogTransparentColor1; |
| | | |
| | | FrameLayout contentView = new FrameLayout() |
| | |
| | | |
| | | Button btnTitle = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(16), |
| | | Height = Application.GetRealHeight(30), |
| | | Y = Application.GetRealHeight(20), |
| | | Height = Application.GetRealHeight(22), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsBold = true, |
| | | TextID = titleId, |
| | | Text = titleStr, |
| | | }; |
| | | contentView.AddChidren(btnTitle); |
| | | |
| | | //提示内容按钮 |
| | | Button btnMsg = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Height = Application.GetRealHeight(25), |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealHeight(200), |
| | | Y = btnTitle.Bottom + Application.GetRealHeight(4), |
| | | X = Application.GetRealWidth(6), |
| | | Height = Application.GetRealHeight(46), |
| | | Width = Application.GetRealWidth(258), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextID = msgId, |
| | | Text = msgStr, |
| | | IsMoreLines = true, |
| | | }; |
| | | contentView.AddChidren(btnMsg); |
| | | |
| | |
| | | //例:右下圆角 大小为50 |
| | | int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), mRectCornerID); |
| | | |
| | | |
| | | btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | this.Close(); |
| | |
| | | /// <param name="callBackAction"></param> |
| | | public void ShowDialog(int titleId, int msgId, Action okAction, Action cancelAction = null) |
| | | { |
| | | this.ShowDialogBase(titleId, msgId, okAction, cancelAction); |
| | | this.ShowDialogBase(Language.StringByID(titleId), Language.StringByID(msgId), okAction, cancelAction); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="confirmID"></param> |
| | | public void ShowDialog(int titleId, int msgId, Action okAction, Action cancelAction, int cancelID, int confirmID) |
| | | { |
| | | this.ShowDialogBase(titleId, msgId, okAction, cancelAction, cancelID, confirmID); |
| | | this.ShowDialogBase(Language.StringByID(titleId), Language.StringByID(msgId), okAction, cancelAction, cancelID, confirmID); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载提示Dialog |
| | | /// </summary> |
| | | /// <param name="titleId"></param> |
| | | /// <param name="msgId"></param> |
| | | /// <param name="callBackAction"></param> |
| | | public void ShowDialog(string titleStr, string msgStr, Action okAction, Action cancelAction = null) |
| | | { |
| | | this.ShowDialogBase(titleStr, msgStr, okAction, cancelAction); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载提示Dialog |
| | | /// 可以自定义按钮文字 |
| | | /// </summary> |
| | | /// <param name="titleStr"></param> |
| | | /// <param name="msgStr"></param> |
| | | /// <param name="okAction"></param> |
| | | /// <param name="cancelAction"></param> |
| | | /// <param name="cancelID"></param> |
| | | /// <param name="confirmID"></param> |
| | | public void ShowDialog(string titleStr, string msgStr, Action okAction, Action cancelAction, int cancelID, int confirmID) |
| | | { |
| | | this.ShowDialogBase(titleStr, msgStr, okAction, cancelAction, cancelID, confirmID); |
| | | } |
| | | |
| | | } |