using System;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
public class FaceSettingResultPage : FrameLayout
{
FrameLayout bodyView;
Action backAction;
public FaceSettingResultPage(Action action)
{
bodyView = this;
backAction = action;
}
///
///
///
/// 是否成功
public void LoadPage(bool isSuccess)
{
new TopViewDiv(bodyView, Language.StringByID(StringId.FacePassage)).LoadTopView();
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
var contentView = new FrameLayout()
{
Y = Application.GetRealHeight(64),
Height = Application.GetRealHeight(667 - 64),
};
bodyView.AddChidren(contentView);
var btnResultIcon = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(99),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(100),
UnSelectedImagePath = "PersonalCenter/FacePassage/FailIcon.png",
SelectedImagePath = "PersonalCenter/FacePassage/TrueIcon.png",
IsSelected = isSuccess,
};
contentView.AddChidren(btnResultIcon);
Button btnResultText = new Button()
{
Y = Application.GetRealHeight(240),
Height = Application.GetRealHeight(40),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
};
contentView.AddChidren(btnResultText);
if(isSuccess)
{
btnResultText.TextID = StringId.FaceInputSucceeded;
}
else
{
btnResultText.TextID = StringId.FaceInputFailed;
}
var btnSetFaceId = new Button()
{
Y = Application.GetRealHeight(539),
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(220),
Height = Application.GetRealWidth(44),
Radius = (uint)Application.GetRealWidth(22),
BackgroundColor = CSS_Color.MainColor,
TextID = isSuccess ? StringId.Complete :StringId.Retry,
TextSize = CSS_FontSize.SubheadingFontSize,
TextColor = CSS_Color.MainBackgroundColor,
TextAlignment = TextAlignment.Center,
IsBold = true,
};
contentView.AddChidren(btnSetFaceId);
btnSetFaceId.MouseUpEventHandler = (sender, e) => {
if (isSuccess)
{
this.RemoveFromParent();
}
else
{
backAction?.Invoke();
this.RemoveFromParent();
}
};
}
}
}