JLChen
2020-05-28 04bd96cbf5d12a4e4b116d2b05fd0d05ea81ee23
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
using System;
 
namespace Shared.SimpleControl.Phone
{
    public class FirstRemoteUnlock : FrameLayout
    {
        DoorLock doorLock;
        public FirstRemoteUnlock (DoorLock dl)
        {
            this.doorLock = dl;
            BackgroundColor = SkinStyle.Current.MainColor;
         }
 
        public void ShowDoorLockRoom ()
        {
            #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.RemoteUnlock,
                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,
                Gravity = Gravity.CenterVertical,
            };
            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 FrameLayout  () {
                Y = topView.Bottom,
                Height = Application.GetRealHeight (Application.DesignHeight - 126),
                BackgroundColor = SkinStyle.Current.ViewColor,
            };
            AddChidren (bodyView);
 
            Button btnText = new Button () {
                Height = Application.GetRealHeight (80),
                Y = Application.GetRealHeight (50),
                TextID = R.MyInternationalizationString.WelcomeToUseRemoteUnLock,
                TextAlignment = TextAlignment.Center,
                TextSize = 20,
                TextColor = SkinStyle.Current.TextColor1,
            };
            bodyView.AddChidren (btnText);
 
            Button btnText2 = new Button () {
                Height = Application.GetRealHeight (70),
                Y = btnText.Bottom  ,
                TextID = R.MyInternationalizationString.FirstUnLockRemind,
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
                TextSize = 15,
             };
            bodyView.AddChidren (btnText2);
 
            var frameLayoutSet = new FrameLayout  () {
                Height = Application.GetRealHeight (80),
                 Y = Application.GetRealHeight (280),
                 Radius = 10,
            };
            bodyView. AddChidren (frameLayoutSet);
 
            var btnSetNow = new Button () {
                Height = Application.GetRealHeight (80),
                Width = Application.GetRealWidth (240),
                X = Application.GetRealWidth (50),
                TextID = R.MyInternationalizationString.SetNow,
                TextSize = 16,
                BackgroundColor = SkinStyle.Current.TitileView,
                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
                TextColor = SkinStyle.Current.TextColor1,
                Radius = 5,
              };
            frameLayoutSet.AddChidren (btnSetNow);
            btnSetNow.MouseDownEventHandler += (sender, e) => {
                btnSetNow.IsSelected = true;
                this.RemoveFromParent ();
 
                RemoteUnlockPasswordSet unlockView = new RemoteUnlockPasswordSet (doorLock);
                UserMiddle.DevicePageView.AddChidren (unlockView);
                unlockView.ShowDoorLockRemoteSetPassword ();
                UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
 
             };
            btnSetNow.MouseUpEventHandler += (sender, e) => {
                btnSetNow.IsSelected = false;
            };
 
            var btnSetLater = new Button () {
                Width = Application.GetRealWidth (240),
                Height = Application.GetRealHeight (80),
                X = Application.GetRealWidth (360),
                TextID = R.MyInternationalizationString.SetLater,
                 TextAlignment = TextAlignment.Center,
                TextSize = 16,
                BackgroundColor = SkinStyle.Current.TitileView,
                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
                TextColor = SkinStyle.Current.TextColor1,
                Radius = 5,
             };
            frameLayoutSet.AddChidren (btnSetLater);
 
            btnSetLater.MouseDownEventHandler += (sender, e) => {
                var alert = new Alert (Language.StringByID (R.MyInternationalizationString.Tip ), Language.StringByID (R.MyInternationalizationString.SetLaterRemind), Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim));
                 alert.Show ();
                alert.ResultEventHandler += (sender2, e2) => {
                    if (e2) {
                        this.RemoveFromParent ();
 
                        RemotelyUnlock unlockView = new RemotelyUnlock (doorLock);
                        UserMiddle.DevicePageView.AddChidren (unlockView);
                        unlockView.ShowUserRemoteUnLock ();
                        UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
                      }
                };
             };
            btnSetLater.MouseUpEventHandler += (sender, e) => {
                btnSetLater.IsSelected = false;
            };
        }
    }
}