tzy
2021-05-30 1c63243a7bcc330b7293cc8d5ec81c4c52018196
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class ResidentialManagePage : FrameLayout
    {
        #region 区域控件列表
        FrameLayout bodyView;
 
        /// <summary>
        /// 住宅名称显示按钮
        /// </summary>
        Button btnResidenceName;
        /// <summary>
        /// 住宅名称编辑按钮
        /// </summary>
        Button btnEditResidenceNameIcon;
        /// <summary>
        /// 住宅地址编辑按钮
        /// </summary>
        Button btnLocationAddressIcon;
        /// <summary>
        /// 住宅地址
        /// </summary>
        Button btnResidenceAddress;
 
        /// <summary>
        /// 楼层管理Row
        /// </summary>
        FrameLayout floorManagementRow;
        /// <summary>
        /// 楼层管理跳转按钮
        /// </summary>
        Button btnFloorManagementSkinIcon;
        /// <summary>
        /// 楼层名称显示按钮
        /// </summary>
        Button btnFloorManagementTitle;
        /// <summary>
        /// 房间管理Row
        /// </summary>
        FrameLayout roomManagementRow;
        /// <summary>
        /// 房间管理跳转按钮
        /// </summary>
        Button btnRoomManagementSkinIcon;
        /// <summary>
        /// 房间名称
        /// </summary>
        Button btnRoomManagementTitle;
 
        /// <summary>
        /// 调试权限开关按钮
        /// </summary>
        Button btnCommissioningAuthoritySwitchIcon;
 
        #region 管理员权限迁移
        FrameLayout administratorPermissionMigrationRow;
        Button btnAdministratorPermissionMigrationTitle;
        Button btnAdministratorPermissionMigrationExplan;
        Button btnAdministratorPermissionMigrationSkinIcon;
        #endregion
 
        #region 过户
        /// <summary>
        /// 
        /// </summary>
        FrameLayout transferRow;
        /// <summary>
        /// 
        /// </summary>
        Button btnTransferTitle;
        /// <summary>
        /// 
        /// </summary>
        Button btnTrasferExplan;
        /// <summary>
        /// 
        /// </summary>
        Button btnTrasferSkinIcon;
        #endregion
 
        #endregion
        /// <summary>
        /// 更新住宅名称的回调函数
        /// </summary>
        Action upateResidenceName;
 
        public ResidentialManagePage(Action action)
        {
            bodyView = this;
            upateResidenceName = action;
        }
 
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.ResidenceManage)).LoadTopView();
 
            VerticalScrolViewLayout contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(667 - 64),
                ScrollEnabled = false,
            };
            bodyView.AddChidren(contentView);
 
 
            #region 住宅名称
            FrameLayout residenceNameRow;
            residenceNameRow = new FrameLayout()
            {
                Y = Application.GetRealHeight(72),
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(residenceNameRow);
            Button btnResidenceNameTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(78),
                TextID = StringId.ResidenceName,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            residenceNameRow.AddChidren(btnResidenceNameTitle);
 
            btnResidenceName = new Button()
            {
                X = Application.GetRealWidth(2) + btnResidenceNameTitle.Right,
                Width = Application.GetRealWidth(200),
                Text = DB_ResidenceData.Instance.CurrentRegion.homeName,
                TextSize = CSS_FontSize.TextFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.TextualColor,
            };
            residenceNameRow.AddChidren(btnResidenceName);
 
            btnEditResidenceNameIcon = new Button()
            {
                X = Application.GetRealWidth(333),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/Edit.png",
            };
            residenceNameRow.AddChidren(btnEditResidenceNameIcon);
 
            #endregion
            residenceNameRow.AddChidren(
                new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(49),
                    Height = Application.GetRealHeight(1),
                    Width = Application.GetRealWidth(343),
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
            #region 住宅地址
            var residenceAddressRow = new FrameLayout()
            {
                Y = residenceNameRow.Bottom,
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(residenceAddressRow);
 
            var btnResidenceAddressTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(78),
                TextID = StringId.ResidenceAddress,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            residenceAddressRow.AddChidren(btnResidenceAddressTitle);
 
            btnLocationAddressIcon = new Button()
            {
                X = Application.GetRealWidth(333),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                //UnSelectedImagePath = "Public/LocationAddressIcon.png",
                UnSelectedImagePath = "Public/Edit.png",
            };
            residenceAddressRow.AddChidren(btnLocationAddressIcon);
 
            btnResidenceAddress = new Button()
            {
                X = Application.GetRealWidth(2) + btnResidenceNameTitle.Right,
                Width = Application.GetRealWidth(200),
                Text = DB_ResidenceData.Instance.CurrentRegion.homeAddress,
                TextSize = CSS_FontSize.TextFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.TextualColor,
            };
            residenceAddressRow.AddChidren(btnResidenceAddress);
            #endregion
            #region 楼层管理
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
 
            floorManagementRow = new FrameLayout()
            {
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(floorManagementRow);
 
            btnFloorManagementTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(308),
                TextID = StringId.FloorsManagement,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            floorManagementRow.AddChidren(btnFloorManagementTitle);
 
            btnFloorManagementSkinIcon = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/RightIcon.png",
            };
            floorManagementRow.AddChidren(btnFloorManagementSkinIcon);
 
            floorManagementRow.AddChidren(
                new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(49),
                    Height = Application.GetRealHeight(1),
                    Width = Application.GetRealWidth(343),
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
            #endregion
 
            #region 房间管理
            roomManagementRow = new FrameLayout()
            {
                Y = floorManagementRow.Bottom,
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(roomManagementRow);
 
            btnRoomManagementTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(300),
                TextID = StringId.RoomsManagement,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            roomManagementRow.AddChidren(btnRoomManagementTitle);
 
            btnRoomManagementSkinIcon = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/RightIcon.png",
            };
            roomManagementRow.AddChidren(btnRoomManagementSkinIcon);
            #endregion
 
            #region 管理员权限迁移
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            administratorPermissionMigrationRow = new FrameLayout()
            {
                Height = Application.GetRealHeight(65),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            //contentView.AddChidren(administratorPermissionMigrationRow);
 
            btnAdministratorPermissionMigrationTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(24),
                TextID = StringId.AdministratorPermissionMigration,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            administratorPermissionMigrationRow.AddChidren(btnAdministratorPermissionMigrationTitle);
 
            btnAdministratorPermissionMigrationExplan = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = btnAdministratorPermissionMigrationTitle.Bottom,
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(21),
                TextID = StringId.AdministratorPermissionMigrationExPlan,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.PromptingColor1,
            };
            administratorPermissionMigrationRow.AddChidren(btnAdministratorPermissionMigrationExplan);
 
 
            btnAdministratorPermissionMigrationSkinIcon = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/RightIcon.png",
            };
            administratorPermissionMigrationRow.AddChidren(btnAdministratorPermissionMigrationSkinIcon);
 
            administratorPermissionMigrationRow.AddChidren(
                new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(64),
                    Height = Application.GetRealHeight(1),
                    Width = Application.GetRealWidth(343),
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
            #endregion
 
            #region 过户
            transferRow = new FrameLayout()
            {
                Y = administratorPermissionMigrationRow.Bottom,
                Height = Application.GetRealHeight(65),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            //有网关才能过户
            if (DB_ResidenceData.Instance.HomeGateway != null && string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId) == false
                && DB_ResidenceData.Instance.CurrentRegion.isOtherShare == false)
            {
                contentView.AddChidren(transferRow);
            }
 
            btnTransferTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(24),
                TextID = StringId.Transfer,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            transferRow.AddChidren(btnTransferTitle);
 
            btnTrasferExplan = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = btnTransferTitle.Bottom,
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(21),
                TextID = StringId.TransferExPlan,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.PromptingColor1,
            };
            transferRow.AddChidren(btnTrasferExplan);
 
            btnTrasferSkinIcon = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/RightIcon.png",
            };
            transferRow.AddChidren(btnTrasferSkinIcon);
            #endregion
 
            #region 调试权限
 
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            FrameLayout commissioningAuthorityRow;
            commissioningAuthorityRow = new FrameLayout()
            {
                Height = Application.GetRealHeight(65),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(commissioningAuthorityRow);
 
 
            var btnCommissioningAuthorityTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(24),
                TextID = StringId.CommissioningAuthority,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            commissioningAuthorityRow.AddChidren(btnCommissioningAuthorityTitle);
 
            var btnCommissioningAuthorityExplan = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = btnCommissioningAuthorityTitle.Bottom,
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(21),
                TextID = StringId.CommissioningAuthorityExPlan,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.PromptingColor1,
            };
            commissioningAuthorityRow.AddChidren(btnCommissioningAuthorityExplan);
 
            btnCommissioningAuthoritySwitchIcon = new Button()
            {
                X = Application.GetRealWidth(314),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(48),
                Height = Application.GetMinRealAverage(36),
                UnSelectedImagePath = "Public/Switch.png",
                SelectedImagePath = "Public/SwitchOn.png",
                IsSelected = DB_ResidenceData.Instance.CurrentRegion.debugPerm
            };
            commissioningAuthorityRow.AddChidren(btnCommissioningAuthoritySwitchIcon);
 
            btnCommissioningAuthoritySwitchIcon.MouseUpEventHandler = (sender, e) =>
            {
                DB_ResidenceData.Instance.CurrentRegion.debugPerm = !DB_ResidenceData.Instance.CurrentRegion.debugPerm;
                btnCommissioningAuthoritySwitchIcon.IsSelected = DB_ResidenceData.Instance.CurrentRegion.debugPerm;
                new System.Threading.Thread(() =>
                {
                    new DAL.Server.HttpServerRequest().ChangeResidenceDebugPerm(DB_ResidenceData.Instance.CurrentRegion.debugPerm);
                })
                { IsBackground = true }.Start();
            };
 
            #endregion
 
 
            LoadEventList();
        }
    }
}