using Shared;
|
using HDL_ON.UI.CSS;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace HDL_ON.Stan
|
{
|
/// <summary>
|
/// 底部弹窗的底层共通
|
/// </summary>
|
public class BottomDialogCommon
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 取消控件
|
/// </summary>
|
public NormalViewControl btnCancel = null;
|
/// <summary>
|
/// 确认控件
|
/// </summary>
|
public NormalViewControl btnConfirm = null;
|
/// <summary>
|
/// 标题
|
/// </summary>
|
public string StrTitle = null;
|
/// <summary>
|
/// 行高度
|
/// </summary>
|
public int RowHeight = Application.GetRealHeight(50);
|
/// <summary>
|
/// 行数
|
/// </summary>
|
public int RowCount = 0;
|
/// <summary>
|
/// 点击背景时,是否关闭弹窗
|
/// </summary>
|
public bool ClickBackClose = true;
|
/// <summary>
|
/// 整个弹窗对象
|
/// </summary>
|
private Dialog FrameDialog = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 初始化底层控件(返回的是四周有圆角的白色区域控件),此方法由封装控件底层调用,请勿随便调用
|
/// </summary>
|
public NormalFrameLayout InitBaseControl()
|
{
|
//整个灰色界面
|
this.FrameDialog?.Close();
|
this.FrameDialog = new Dialog();
|
|
var dialogBody = new NormalFrameLayout();
|
FrameDialog.AddChidren(dialogBody);
|
FrameDialog.Show();
|
dialogBody.ButtonClickEvent += (sender, e) =>
|
{
|
if (ClickBackClose == true && this.btnCancel != null)
|
{
|
this.btnCancel.ButtonClickEvent?.Invoke(this.btnCancel, null);
|
}
|
};
|
|
//白色背景
|
var frameWhiteBack = new NormalFrameLayout();
|
frameWhiteBack.Width = Application.GetRealWidth(343);
|
frameWhiteBack.Height = RowHeight * (RowCount + 1);
|
frameWhiteBack.Radius = (uint)Application.GetRealWidth(12);
|
frameWhiteBack.Gravity = Gravity.CenterHorizontal;
|
frameWhiteBack.Y = dialogBody.Height - RowHeight * (RowCount + 1) - Application.GetRealHeight(20);
|
frameWhiteBack.BackgroundColor = CSS_Color.MainBackgroundColor;
|
dialogBody.AddChidren(frameWhiteBack);
|
|
//取消
|
this.btnCancel = new NormalViewControl(90, 48, true);
|
btnCancel.X = HdlControlResourse.XXLeft;
|
btnCancel.Y = Application.GetRealHeight(2);
|
btnCancel.TextColor = CSS_Color.PromptingColor1;
|
btnCancel.TextID = StringId.Cancel;
|
frameWhiteBack.AddChidren(btnCancel);
|
|
//标题
|
var btnTitle = new NormalViewControl(243, 22, true);
|
btnTitle.Y = Application.GetRealHeight(15);
|
btnTitle.TextAlignment = TextAlignment.Center;
|
btnTitle.Gravity = Gravity.CenterHorizontal;
|
btnTitle.IsBold = true;
|
btnTitle.TextSize = CSS_FontSize.SubheadingFontSize;
|
btnTitle.TextColor = CSS_Color.FirstLevelTitleColor;
|
btnTitle.Text = this.StrTitle;
|
frameWhiteBack.AddChidren(btnTitle);
|
|
//确认
|
this.btnConfirm = new NormalViewControl(90, 48, true);
|
btnConfirm.X = frameWhiteBack.Width - Application.GetRealWidth(90) - btnCancel.X;
|
btnConfirm.Y = btnCancel.Y;
|
btnConfirm.TextAlignment = TextAlignment.CenterRight;
|
btnConfirm.TextColor = CSS_Color.MainColor;
|
btnConfirm.TextID = StringId.Confirm;
|
frameWhiteBack.AddChidren(btnConfirm);
|
|
return frameWhiteBack;
|
}
|
|
#endregion
|
|
#region ■ 一般方法___________________________
|
|
/// <summary>
|
/// 关闭界面
|
/// </summary>
|
public virtual void Close()
|
{
|
this.FrameDialog?.Close();
|
}
|
|
#endregion
|
}
|
}
|