黄学彪
2020-12-16 0d9f64668fd7350d6a21fd157e32009a96d98134
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
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone
{
    /// <summary>
    /// 数字表盘密码输入的弹窗界面
    /// </summary>
    public class NumberPswInputDialogForm : DialogCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 输入结束事件
        /// </summary>
        public Action<string> FinishInputEvent = null;
        /// <summary>
        /// 密码输入控件
        /// </summary>
        private PswNumberInputControl pswControl = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_PasswordText">标题提示</param>
        /// <param name="i_pswLenth">密码长度</param>
        public void ShowForm(string i_PasswordText, int i_pswLenth)
        {
            //初始化中部信息
            this.InitMiddleFrame(i_PasswordText, i_pswLenth);
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        /// <param name="i_PasswordText">标题提示</param>
        /// <param name="i_pswLenth">密码长度</param>
        private void InitMiddleFrame(string i_PasswordText, int i_pswLenth)
        {
            var frameBack = new FrameLayout();
            frameBack.Y = Application.GetRealHeight(160);
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.Width = Application.GetRealWidth(965);
            frameBack.Height = Application.GetRealHeight(1584);
            frameBack.BackgroundColor = UserCenterColor.Current.White;
            frameBack.Radius = (uint)Application.GetRealHeight(17);
            bodyFrameLayout.AddChidren(frameBack);
 
            //密码输入控件
            this.pswControl = new PswNumberInputControl(i_PasswordText, i_pswLenth);
            pswControl.Gravity = Gravity.CenterHorizontal;
            pswControl.Y = Application.GetRealHeight(81);
            frameBack.AddChidren(pswControl);
            pswControl.InitControl();
            //改变删除按钮的坐标
            pswControl.ChangedDeleteButtonPoint(-1, pswControl.Height, false);
            //添加关闭按钮
            var btnClose = pswControl.AddCloseButton();
            btnClose.ButtonClickEvent += (sender, e) =>
            {
                this.CloseForm();
            };
            pswControl.FinishInputEvent += (strPsw) =>
            {
                this.FinishInputEvent?.Invoke(strPsw);
            };
        }
 
        #endregion
 
        #region ■ 一般方法___________________________
 
        /// <summary>
        /// 设置错误信息
        /// </summary>
        /// <param name="i_Msg"></param>
        public void SetErrorMsg(string i_Msg)
        {
            this.pswControl?.SetErrorMsg(i_Msg);
        }
 
        #endregion
 
        #region ■ 界面关闭___________________________
 
        /// <summary>
        /// 界面关闭
        /// </summary>
        public override void CloseFormBefore()
        {
            //取消事件
            this.FinishInputEvent = null;
            this.pswControl = null;
 
            base.CloseFormBefore();
        }
 
        #endregion
    }
}