using Shared;
using HDL_ON.UI.CSS;
using System;
using System.Collections.Generic;
using System.Text;
namespace HDL_ON.Stan
{
///
/// 底部弹窗的底层共通
///
public class BottomDialogCommon
{
#region ■ 变量声明___________________________
///
/// 取消控件
///
public NormalViewControl btnCancel = null;
///
/// 确认控件
///
public NormalViewControl btnConfirm = null;
///
/// 标题
///
public string StrTitle = null;
///
/// 行高度
///
public int RowHeight = Application.GetRealHeight(50);
///
/// 行数
///
public int RowCount = 0;
///
/// 点击背景时,是否关闭弹窗
///
public bool ClickBackClose = true;
///
/// 整个弹窗对象
///
private Dialog FrameDialog = null;
#endregion
#region ■ 初始化_____________________________
///
/// 初始化底层控件(返回的是四周有圆角的白色区域控件),此方法由封装控件底层调用,请勿随便调用
///
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;
btnCancel.TextSize = CSS_FontSize.TextFontSize;
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;
btnConfirm.TextSize = CSS_FontSize.TextFontSize;
frameWhiteBack.AddChidren(btnConfirm);
return frameWhiteBack;
}
#endregion
#region ■ 一般方法___________________________
///
/// 关闭界面
///
public virtual void Close()
{
this.FrameDialog?.Close();
}
#endregion
}
}