黄学彪
2020-09-22 ade5917841b0fdcb1df7353ef7c56b1a1bdc9282
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
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.Safety
{
    /// <summary>
    /// 安防密码的菜单界面
    /// </summary>
    public class PasswordMenuForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPasswordSettion));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            var listView = new VerticalListControl(23);
            listView.Height = bodyFrameLayout.Height;
            listView.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(listView);
 
            //添加【安防密码】行
            var rowUserPsw = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(rowUserPsw);
            //图标
            var btnUserPswIcon = rowUserPsw.AddLeftIcon(81);
            btnUserPswIcon.UnSelectedImagePath = "Item/PswSettionSelected.png";
            //安防密码
            var btnUserPswText = rowUserPsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSafetyPassword), 700, 60);
            btnUserPswText.TextSize = 15;
            btnUserPswText.Y = Application.GetRealHeight(12) + rowUserPsw.chidrenYaxis;
            rowUserPsw.AddChidren(btnUserPswText, ChidrenBindMode.BindEvent);
            //用于在家布防、离家布防、撤防操作
            var btnTip1 = rowUserPsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uUserInGarrisonAndWithdrawGarrison), 700, 50, true);
            //这个坐标有点特殊
            btnTip1.Y = Application.GetRealHeight(72) + rowUserPsw.chidrenYaxis;
            btnTip1.TextSize = 12;
            btnTip1.TextColor = UserCenterColor.Current.TextGrayColor1;
            rowUserPsw.AddChidren(btnTip1, ChidrenBindMode.BindEvent);
            //向右的图标
            rowUserPsw.AddRightArrow();
            //底线
            rowUserPsw.AddBottomLine();
            rowUserPsw.ButtonClickEvent += async (sender, e) =>
            {
                //打开画面之前,先校验管理员密码
                bool result = await HdlSafeguardLogic.Current.ShowSafetyAdminValidatedDialog();
                if (result == false)
                {
                    return;
                }
                var form = new PasswordListUserForm();
                form.AddForm();
            };
 
            //添加【胁迫密码】行
            var rowCoercePsw = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(rowCoercePsw);
            //图标
            var btnCoercePswIcon = rowCoercePsw.AddLeftIcon(81);
            btnCoercePswIcon.UnSelectedImagePath = "Item/PswSettionSelected.png";
            //胁迫密码
            var btnCoercePswText = rowCoercePsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoercePassword), 700, 60);
            btnCoercePswText.TextSize = 15;
            btnCoercePswText.Y = Application.GetRealHeight(12) + rowCoercePsw.chidrenYaxis;
            rowCoercePsw.AddChidren(btnCoercePswText, ChidrenBindMode.BindEvent);
            //输入该密码,立即通知他人
            var btnTip2 = rowCoercePsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEnterPasswordToNotifyOthersImmediately), 700, 50, true);
            //这个坐标有点特殊
            btnTip2.Y = Application.GetRealHeight(72) + rowCoercePsw.chidrenYaxis;
            btnTip2.TextSize = 12;
            btnTip2.TextColor = UserCenterColor.Current.TextGrayColor1;
            rowCoercePsw.AddChidren(btnTip2, ChidrenBindMode.BindEvent);
            //向右的图标
            rowCoercePsw.AddRightArrow();
            rowCoercePsw.ButtonClickEvent += async (sender, e) =>
            {
                //打开画面之前,先校验管理员密码
                bool result = await HdlSafeguardLogic.Current.ShowSafetyAdminValidatedDialog();
                if (result == false)
                {
                    return;
                }
                //判断是否设置有胁迫密码
                var listData = await HdlSafeguardLogic.Current.GetAllUserPassword();
                if (listData == null)
                {
                    return;
                }
                foreach (var data in listData)
                {
                    if (data.UserId == 5)
                    {
                        //修改密码
                        var form1 = new CoercePswEditorForm();
                        form1.AddForm(data.Password, data.PassWordTips);
                        return;
                    }
                }
                //新建密码
                var form = new CoercePswAddNewForm();
                form.AddForm(string.Empty);
            };
            listView.AdjustRealHeight(Application.GetRealHeight(23));
        }
 
        #endregion
    }
}