xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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;
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="isSuccess">是否成功</param>
        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();
                }
            };
 
        }
    }
}