JLChen
2020-06-05 f86c8b5dcf5c84386745b009fc4115fa9db3b76d
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
using System;
 
namespace Shared.SimpleControl.Phone
{
    public class UserDoorLock : FrameLayout
    {
 
        public UserDoorLock ()
        {
            BackgroundColor = SkinStyle.Current.MainColor;
        }
 
        public void ShowDoorLockRoom (DoorLock doorLock)
        {
            #region 标题
            FrameLayout topView = new FrameLayout () {
                Y = Application.GetRealHeight (36),
                Height = Application.GetRealHeight (90),
                BackgroundColor = SkinStyle.Current.MainColor,
            };
            AddChidren (topView);
 
            Button title = new Button () {
                TextAlignment = TextAlignment.Center,
                TextID = R.MyInternationalizationString.Menu,
                TextSize = 19,
                TextColor = SkinStyle.Current.TextColor1,
            };
            topView.AddChidren (title);
 
            Button logo = new Button () {
                Width = Application.GetRealWidth (154),
                Height = Application.GetRealHeight (90),
                X = Application.GetRealWidth (486),
                UnSelectedImagePath = MainPage.LogoString,
            };
            topView.AddChidren (logo);
            Button back = new Button () {
                Height = Application.GetRealHeight (90),
                Width = Application.GetRealWidth (85),
                UnSelectedImagePath = "Item/Back.png",
                SelectedImagePath = "Item/BackSelected.png",
                Gravity = Gravity.CenterVertical,
            };
            topView.AddChidren (back);
            back.MouseUpEventHandler += (sender, e) => {
                this.RemoveFromParent ();
            };
            #endregion
 
            var BodyView = new VerticalScrolViewLayout () {
                Y = topView.Bottom,
                Height = Application.GetRealHeight (Application.DesignHeight - 126),
                BackgroundColor = SkinStyle.Current.ViewColor,
            };
            AddChidren (BodyView);
 
            for (int i = 0; i < 5; i++) {
                if (i == 3)
                    continue;
                FrameLayout RowView = new FrameLayout () {
                    Height = Application.GetRealHeight (110),
                    BackgroundColor = SkinStyle.Current.ViewColor,
                };
                BodyView.AddChidren (RowView);
 
                Button btnIcon = new Button () {
                    Width = Application.GetRealHeight (13),
                    Height = Application.GetRealHeight (13),
                    X = Application.GetRealWidth (40),
                    UnSelectedImagePath = "Item/Point.png",
                    SelectedImagePath = "Item/PointSelected.png",
                    Gravity = Gravity.CenterVertical,
                };
                RowView.AddChidren (btnIcon);
 
                Button UserManagement = new Button () {
                    X = btnIcon.Right + Application.GetRealWidth (20),
                    Width = Application.GetRealWidth (300),
                    Height = Application.GetRealHeight (110),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = SkinStyle.Current.TextColor1,
                };
                RowView.AddChidren (UserManagement);
                if (i == 0) {
                    UserManagement.TextID = R.MyInternationalizationString.RemotelyUnlock;
                } else if (i == 1) {
                    UserManagement.TextID = R.MyInternationalizationString.UserManagement;
                } else if (i == 2) {
                    UserManagement.TextID = R.MyInternationalizationString.UnlockRecord;
                } else if (i == 3) {
                    UserManagement.TextID = R.MyInternationalizationString.RemindSetting;
                } else if (i == 4) {
                    UserManagement.TextID = R.MyInternationalizationString.SystemSetting;
                } else if (i == 5) {
                    // UserManagement.TextID = R.MyInternationalizationString.RemindSetting;
                }
 
                var btnRight = new Button () {
                    Width = Application.GetRealWidth (28),
                    Height = Application.GetRealHeight (40),
                    X = UserManagement.Right + Application.GetRealWidth (200),
                    UnSelectedImagePath = "Item/Right.png",
                    SelectedImagePath = "Item/RightSelected.png",
                    Gravity = Gravity.CenterVertical,
                };
                RowView.AddChidren (btnRight);
 
                var line2 = new Button () {
                    Y = RowView.Height - 1,
                    Height = 1,
                    BackgroundColor = SkinStyle.Current.LineColor,
                };
                RowView.AddChidren (line2);
 
                int currentIndex = i;
                EventHandler<MouseEventArgs> eHandler = (sender, e) => {
                    if (currentIndex == 0) {
                        if (doorLock.GetDoorLockPassword () == null && !doorLock.isDoorLockConverter) {
                            FirstRemoteUnlock unlockView = new FirstRemoteUnlock (doorLock);
                            UserMiddle.DevicePageView.AddChidren (unlockView);
                            unlockView.ShowDoorLockRoom ();
                            UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                        } else {
                            RemotelyUnlock unlockView = new RemotelyUnlock (doorLock);
                            UserMiddle.DevicePageView.AddChidren (unlockView);
                            unlockView.ShowUserRemoteUnLock ();
                            UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                        }
                    } else if (currentIndex == 1) {
                        DoorLockUserMangement dView = new DoorLockUserMangement (doorLock);
                        UserMiddle.DevicePageView.AddChidren (dView);
                        dView.ShowUserManagement ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                    } else if (currentIndex == 2) {
                        DoorLockRecord recordView = new DoorLockRecord (doorLock);
                        UserMiddle.DevicePageView.AddChidren (recordView);
                        recordView.ShowUserHisroryRecord ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                    } else if (currentIndex == 3) {
                        DoorLockAlarmScene recordView = new DoorLockAlarmScene (doorLock);
                        UserMiddle.DevicePageView.AddChidren (recordView);
                        recordView.DoorLockAlarmSceneShow ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                    } else if (currentIndex == 4) {
                        DoorLockSystemSetting dss = new DoorLockSystemSetting (doorLock);
                        UserMiddle.DevicePageView.AddChidren (dss);
                        dss.ShowUserRemoteUnLock ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                    } else if (currentIndex == 5) {
                        DoorLockRemindSetting remindView = new DoorLockRemindSetting (doorLock);
                        UserMiddle.DevicePageView.AddChidren (remindView);
                        remindView.ShowSetTempPassword ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
 
                    }
                };
 
                btnRight.MouseUpEventHandler += eHandler;
                btnIcon.MouseUpEventHandler += eHandler;
                RowView.MouseUpEventHandler += eHandler;
                UserManagement.MouseUpEventHandler += eHandler;
            }
        }
    }
}