using System;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
///
/// 公共页面
/// 操作结果显示页面
///
public class OperationResultDisPalyPage : Dialog
{
Dialog dialog;
FrameLayout bodyView;
public OperationResultDisPalyPage()
{
dialog = this;
bodyView = new FrameLayout();
}
///
/// 操作结果显示页面
///
/// 操作结果
/// 页面标题
/// 提示标题
/// 提示信息
public void LoadPage(bool result,string title,string tipTitle,string tipMsg)
{
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
dialog.AddChidren(bodyView);
new TopViewDiv(dialog,bodyView, title).LoadTopView() ;
Button btnTipIcon = new Button()
{
Y = Application.GetRealHeight(96),
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(180),
Height = Application.GetRealWidth(180),
UnSelectedImagePath = result ? "Public/TipIcon_Successfully.png" : "Public/TipIcon_Failed.png",
};
bodyView.AddChidren(btnTipIcon);
Button btnTipTitle = new Button()
{
Y = Application.GetRealHeight(288),
Height = Application.GetRealHeight(30),
TextColor = result ? CSS_Color.MainColor : CSS_Color.WarningColor,
Text = tipTitle,
TextAlignment = TextAlignment.Center,
TextSize = CSS_FontSize.SubheadingFontSize,
};
bodyView.AddChidren(btnTipTitle);
Button btnTipMsg = new Button()
{
Y = btnTipTitle.Bottom,
Height = Application.GetRealHeight(25),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
Text = tipMsg,
};
bodyView.AddChidren(btnTipMsg);
Button btnConfirm = new Button()
{
Y = Application.GetRealHeight(401),
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(220),
Height = Application.GetRealHeight(44),
Radius = (uint)Application.GetRealHeight(22),
BackgroundColor = CSS_Color.MainColor,
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.MainBackgroundColor,
TextID = StringId.Confirm
};
bodyView.AddChidren(btnConfirm);
btnConfirm.MouseUpEventHandler = (sender, e) => {
this.Close();
};
}
///
/// 附加操作
///
public void AdditionalOperations(string msg,Action action)
{
Button btnCheckIcon = new Button()
{
X = Application.GetRealWidth(78),
Y = Application.GetRealHeight(350),
Width = Application.GetRealWidth(32),
Height = Application.GetRealWidth(32),
UnSelectedImagePath = "Public/ChooseIcon.png",
SelectedImagePath = "Public/ChooseOnIcon.png",
};
bodyView.AddChidren(btnCheckIcon);
Button btnMsg = new Button()
{
X = btnCheckIcon.Right,
Y = Application.GetRealHeight(350),
Width = Application.GetRealWidth(220),
Height = Application.GetRealHeight(32),
TextAlignment = TextAlignment.CenterLeft,
Text = msg,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
};
bodyView.AddChidren(btnMsg);
btnCheckIcon.MouseUpEventHandler = (sender, e) => {
btnCheckIcon.IsSelected = !btnCheckIcon.IsSelected;
action(btnCheckIcon.IsSelected);
};
btnMsg.MouseUpEventHandler = (sender, e) =>{
btnCheckIcon.IsSelected = !btnCheckIcon.IsSelected;
action(btnCheckIcon.IsSelected);
};
}
}
}