wxr
2021-07-01 43b0d5870d528f23ecd6aeceb6cfd4325188b46f
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using System;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 公共页面
    /// 操作结果显示页面
    /// </summary>
    public class OperationResultDisPalyPage : Dialog
    {
        Dialog dialog;
        FrameLayout bodyView;
 
        /// <summary>
        /// 回掉函数
        /// </summary>
        public Action rebackAction = null;
 
        public OperationResultDisPalyPage()
        {
            dialog = this;
            bodyView = new FrameLayout();
        }
 
        /// <summary>
        /// 操作结果显示页面
        /// </summary>
        /// <param name="result">操作结果</param>
        /// <param name="title">页面标题</param>
        /// <param name="tipTitle">提示标题</param>
        /// <param name="tipMsg">提示信息</param>
        /// <param name="confirmText">按钮文本</param>
        public void LoadPage(bool result,string title,string tipTitle,string tipMsg,string confirmText = "")
        {
            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.GetRealWidth(44),
                Radius = (uint)Application.GetRealWidth(22),
                BackgroundColor = CSS_Color.MainColor,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                TextID = StringId.Confirm,
                TextSize = CSS_FontSize.SubheadingFontSize,
            };
            bodyView.AddChidren(btnConfirm);
            if(confirmText != "")
            {
                btnConfirm.Text = confirmText;
            }
 
            btnConfirm.MouseUpEventHandler = (sender, e) => {
                this.Close();
                rebackAction?.Invoke();
            };
 
        }
        /// <summary>
        /// 附加操作
        /// </summary>
        public void AdditionalOperations(string msg,Action<bool> 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.GetRealWidth(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);
            };
        }
    }
}