wei
2021-06-23 d4973876384be55df64de45db8a511d1e0330872
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.Stan;
using System;
using System.Collections.Generic;
using System.Text;
using HDL_ON.Entity;
using HDL_ON.DAL.Server;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 门锁的选择日期时间界面
    /// </summary>
    public class DoorLockUnlockMethordManagerPage : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 列表控件
        /// </summary>
        private VerticalFrameControl listView = null;
        /// <summary>
        /// 开锁方式列表
        /// </summary>
        private List<UnlockMethordInfo> listUnlockInfo = new List<UnlockMethordInfo>();
        /// <summary>
        /// 成员列表
        /// </summary>
        private List<ResidenceMemberInfo> listMember = null;
        /// <summary>
        /// 白色背景的容器控件集合(坐标变更时使用)
        /// </summary>
        private List<NormalFrameLayout> listWhiteFrame = new List<NormalFrameLayout>();
        /// <summary>
        /// 选择的场景(key:门锁的数据库主键    value:场景列表的主键)
        /// </summary>
        private Dictionary<string, List<string>> dicSelectScene = new Dictionary<string, List<string>>();
        /// <summary>
        /// 门锁对象
        /// </summary>
        private Function doorDevice = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_doorDevice">门锁对象</param>
        /// <param name="i_listMember">成员列表</param>
        public void ShowForm(Function i_doorDevice, List<ResidenceMemberInfo> i_listMember)
        {
            this.doorDevice = i_doorDevice;
            this.listMember = i_listMember;
            this.dicSelectScene = new Dictionary<string, List<string>>();
 
            //开锁方式管理
            base.SetTitleText(Language.StringByID(StringId.UnlockingManagement));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            //列表控件
            this.listView = new VerticalFrameControl();
            listView.Height = bodyFrameLayout.Height;
            bodyFrameLayout.AddChidren(listView);
 
            //打开转圈的那个东西
            this.ShowProgressBar();
            HdlThreadLogic.Current.RunThread(() =>
            {
                //初始化开锁方式信息列表
                var result = this.InitUnlockMethordInfoFromClound();
                //关闭转圈的那个东西
                this.CloseProgressBar();
                if (result == false)
                {
                    return;
                }
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //初始化未分配控件
                    this.InitNotAssignControl();
                    //初始化全部成员控件
                    this.InitAllMemberControl();
                    //调整桌布大小
                    this.listView.AdjustTableHeight();
                });
            });
        }
 
        #endregion
 
        #region ■ 初始化未分配控件___________________
 
        /// <summary>
        /// 初始化未分配控件
        /// </summary>
        private void InitNotAssignControl()
        {
            //先初始化
            this.listWhiteFrame = new List<NormalFrameLayout>();
 
            //获取未分配的开锁方式
            var listInfo = new List<UnlockMethordInfo>();
            foreach (var info in this.listUnlockInfo)
            {
                if (info.UserId != string.Empty)
                {
                    continue;
                }
                listInfo.Add(info);
            }
            //白色背景容器
            var frameBack = new NormalFrameLayout();
            frameBack.Y = Application.GetRealHeight(12);
            frameBack.Width = Application.GetRealWidth(343);
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.MainKey = "NotAssign";
            frameBack.Radius = (uint)Application.GetRealWidth(12);
            frameBack.Height = Application.GetRealHeight(50);
            frameBack.BackgroundColor = CSS_Color.MainBackgroundColor;
            frameBack.Visible = listInfo.Count > 0;
            this.listView.frameTable.AddChidren(frameBack);
            this.listWhiteFrame.Add(frameBack);
 
            //未分配
            var frameRow = new FrameRowControl();
            frameBack.AddChidren(frameRow);
            var btnNotAssign = frameRow.AddLeftCaption(Language.StringByID(StringId.Unallocated), 300);
            btnNotAssign.TextSize = CSS_FontSize.SubheadingFontSize;
            btnNotAssign.TextColor = CSS_Color.FirstLevelTitleColor;
            frameRow.AddBottomLine();
 
            for (int i = 0; i < listInfo.Count; i++)
            {
                //添加密码行控件
                this.AddUnlockPasswordRowControl(frameBack, listInfo[i], i != listInfo.Count - 1);
            }
            //调整桌布高度
            listView.AdjustChidrenFrameHeight(frameBack, 0);
        }
 
        #endregion
 
        #region ■ 初始化成员控件_____________________
 
        /// <summary>
        /// 初始化全部成员控件
        /// </summary>
        private void InitAllMemberControl()
        {
            //头像列表
            var listIcon = new List<ImageView>();
            foreach (var info in this.listMember)
            {
                //根据成员信息初始化成员控件
                var btnIcon = this.InitMemberControlByMemberInfo(info);
                listIcon.Add(btnIcon);
            }
            //再加一个空白间隙
            var frameSpace = new NormalFrameLayout();
            frameSpace.Height = Application.GetRealHeight(12);
            frameSpace.Y = this.listView.frameTable.GetChildren(this.listView.frameTable.ChildrenCount - 1).Bottom;
            this.listView.frameTable.AddChidren(frameSpace);
            this.listWhiteFrame.Add(frameSpace);
 
            //下载用户头像
            this.DownLoadUserIcon(listIcon);
        }
 
        /// <summary>
        /// 根据成员信息初始化成员控件
        /// </summary>
        private ImageView InitMemberControlByMemberInfo(ResidenceMemberInfo memberInfo)
        {
            //获取分配给这个成员的开锁方式
            var listInfo = new List<UnlockMethordInfo>();
            foreach (var info in this.listUnlockInfo)
            {
                if (info.UserId != memberInfo.childAccountId)
                {
                    continue;
                }
                listInfo.Add(info);
            }
 
            //白色背景容器
            var frameBack = new NormalFrameLayout();
            frameBack.Width = Application.GetRealWidth(343);
            if (listInfo.Count > 0)
            {
                frameBack.Y = this.listView.frameTable.GetChildren(this.listView.frameTable.ChildrenCount - 1).Bottom + Application.GetRealHeight(12);
            }
            else
            {
                //如果没有开锁方式,则暂时隐藏
                frameBack.Visible = false;
            }
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.MainKey = memberInfo.childAccountId;
            frameBack.Radius = (uint)Application.GetRealWidth(12);
            frameBack.Height = Application.GetRealHeight(80);
            frameBack.BackgroundColor = CSS_Color.MainBackgroundColor;
            this.listView.frameTable.AddChidren(frameBack);
            this.listWhiteFrame.Add(frameBack);
 
            //用户行
            var frameUserRow = new FrameRowControl();
            frameUserRow.Width = frameBack.Width;
            frameUserRow.Height = Application.GetRealHeight(80);
            frameBack.AddChidren(frameUserRow);
            //用户头像
            var btnUserIcon = new ImageView();
            btnUserIcon.X = HdlControlResourse.XXLeft;
            btnUserIcon.Width = Application.GetRealWidth(48);
            btnUserIcon.Height = Application.GetRealWidth(48);
            btnUserIcon.Gravity = Gravity.CenterVertical;
            btnUserIcon.ImagePath = "LoginIcon/2.png";
            btnUserIcon.Radius = (uint)btnUserIcon.Height / 2;
            frameUserRow.AddChidren(btnUserIcon, ChidrenBindMode.NotBind);
            //用户名
            var btnUserName = frameUserRow.AddLeftCaption(memberInfo.nickName, 150);
            btnUserName.X = btnUserIcon.Right + Application.GetRealWidth(12);
            btnUserName.TextColor = CSS_Color.FirstLevelTitleColor;
            //底线
            frameUserRow.AddBottomLine();
            //成员身份背景图片
            var frameUserType = new FrameLayout();
            frameUserType.X = Application.GetRealWidth(220);
            frameUserType.Y = Application.GetRealHeight(16);
            frameUserType.Height = Application.GetRealHeight(58);
            frameUserType.Width = Application.GetRealWidth(180);
            frameUserType.BackgroundImagePath = "PersonalCenter/UserTypebg2.png";//用最长图标的那个
            frameUserRow.AddChidren(frameUserType, ChidrenBindMode.NotBind);
            //成员身份翻译
            var btnUserTypeName = new NormalViewControl(270, 54, true);
            btnUserTypeName.X = Application.GetRealWidth(35);
            btnUserTypeName.Y = Application.GetRealHeight(-2);
            btnUserTypeName.TextColor = CSS_Color.MainBackgroundColor;
            btnUserTypeName.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            btnUserTypeName.TextID = memberInfo.childAccountType == "ADMIN" ? StringId.Administrators : StringId.Member;
            btnUserTypeName.Width = btnUserTypeName.GetRealWidthByText();
            frameUserType.AddChidren(btnUserTypeName);
            //按照控件实际长度,变更背景图的X轴  Application.GetRealWidth(10)为右边余白
            frameUserType.X = frameBack.Width - btnUserTypeName.X - btnUserTypeName.Width - Application.GetRealWidth(10);
 
            for (int i = 0; i < listInfo.Count; i++)
            {
                //添加密码行控件
                this.AddUnlockPasswordRowControl(frameBack, listInfo[i], i != listInfo.Count - 1);
            }
            //调整桌布高度
            listView.AdjustChidrenFrameHeight(frameBack, 0);
 
            return btnUserIcon;
        }
 
        #endregion
 
        #region ■ 生成密码行控件_____________________
 
        /// <summary>
        /// 生成密码行控件
        /// </summary>
        /// <param name="frameFather">父控件</param>
        /// <param name="unlockInfo">开锁方式信息</param>
        /// <param name="addLine">是否添加底线</param>
        private void AddUnlockPasswordRowControl(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo, bool addLine)
        {
            //行控件
            var frameRow = new FrameRowControl();
            frameRow.MainKey = unlockInfo.Id;
            frameRow.RightOffset = Application.GetRealWidth(-32);
            if (frameFather.ChildrenCount > 0)
            {
                //往最底下添加
                frameRow.Y = frameFather.GetChildren(frameFather.ChildrenCount - 1).Bottom;
            }
            frameFather.AddChidren(frameRow);
            if (addLine == true)
            {
                frameRow.AddBottomLine();
            }
 
            //开锁方式备注
            var btnCaption = frameRow.AddLeftCaption(unlockInfo.Remark, 120);
            btnCaption.TextColor = CSS_Color.FirstLevelTitleColor;
 
            //场景联动图标
            IconViewControl btnScene = null;
            //备注编辑图标
            IconViewControl btnEditor = null;
            //分配图标
            IconViewControl btnMove = null;
            //删除图标
            IconViewControl btnDelete = null;
            //更多图标
            var btnMore = frameRow.AddMostRightEmptyIcon(28, 28);
            btnMore.UnSelectedImagePath = "FunctionIcon/DoorLock/More.png";
            btnMore.SelectedImagePath = "FunctionIcon/DoorLock/Hide.png";
            btnMore.ButtonClickEvent += (sender, e) =>
            {
                btnMore.IsSelected = !btnMore.IsSelected;
                btnEditor.Visible = btnMore.IsSelected;
                btnMove.Visible = btnMore.IsSelected;
                btnDelete.Visible = btnMore.IsSelected;
 
                //变更分享场景图标的X轴
                int intSceneX = btnMore.IsSelected == true ? btnEditor.X : btnMore.X;
                btnScene.X = intSceneX - btnScene.Width - Application.GetRealWidth(12);
            };
            //删除图标
            btnDelete = new IconViewControl(28);
            btnDelete.UnSelectedImagePath = "FunctionIcon/DoorLock/Delete.png";
            btnDelete.Gravity = Gravity.CenterVertical;
            btnDelete.X = btnMore.X - btnDelete.Width - Application.GetRealWidth(12);
            btnDelete.Visible = false;
            frameRow.AddChidren(btnDelete, ChidrenBindMode.NotBind);
            btnDelete.ButtonClickEvent += (sender, e) =>
            {
                //删除操作将被同步于实体锁上{0}是否还需要删除?
                HdlMessageLogic.Current.ShowMassage(ShowMsgType.Confirm, Language.StringByID(StringId.DeleteUnlockingMethordMsg), () =>
                {
                    //删除开锁方式
                    this.DeleteUnlockMethrod(frameFather, unlockInfo);
 
                }, Language.StringByID(StringId.ConfirmDeletion));
            };
 
            //分配图标
            btnMove = new IconViewControl(28);
            btnMove.UnSelectedImagePath = "FunctionIcon/DoorLock/Redistribution.png";
            btnMove.Gravity = Gravity.CenterVertical;
            btnMove.X = btnDelete.X - btnMove.Width - Application.GetRealWidth(12);
            btnMove.Visible = false;
            frameRow.AddChidren(btnMove, ChidrenBindMode.NotBind);
            btnMove.ButtonClickEvent += (sender, e) =>
            {
                //分配开锁方式
                this.DistributeUnlockMethord(frameFather, unlockInfo);
            };
 
            //编辑图标
            btnEditor = new IconViewControl(28);
            btnEditor.UnSelectedImagePath = "FunctionIcon/DoorLock/Editor.png";
            btnEditor.Gravity = Gravity.CenterVertical;
            btnEditor.X = btnMove.X - btnEditor.Width - Application.GetRealWidth(12);
            btnEditor.Visible = false;
            frameRow.AddChidren(btnEditor, ChidrenBindMode.NotBind);
            btnEditor.ButtonClickEvent += (sender, e) =>
            {
                new UI.PublicAssmebly().LoadDialog_EditParater(StringId.EditorRemarkName, btnCaption.Text,(textValue)=>
                {
                    btnCaption.Text = textValue;
 
                }, StringId.RemarkNameCanNotEmpty, 0, new List<string>());
            };
 
            //场景联动图标
            btnScene = new IconViewControl(28);
            btnScene.UnSelectedImagePath = "FunctionIcon/DoorLock/BindScene.png";
            btnScene.Gravity = Gravity.CenterVertical;
            btnScene.X = btnMore.X - btnScene.Width - Application.GetRealWidth(12);
            frameRow.AddChidren(btnScene, ChidrenBindMode.NotBind);
            btnScene.ButtonClickEvent += (sender, e) =>
            {
                //显示选择场景弹窗
                this.ShowSelectSceneDialog(unlockInfo);
            };
        }
 
        #endregion
 
        #region ■ 调整白色容器控件的坐标及高度_______
 
        /// <summary>
        /// 调整全部白色容器控件的坐标
        /// </summary>
        private void AdjustAllWhiteFrameLocation()
        {
            //初始Y轴
            int defultYY = 0;
            for (int i = 0; i < this.listWhiteFrame.Count; i++)
            {
                var frame = this.listWhiteFrame[i];
                //不显示的,不做处理
                if (frame.Visible == false) { continue; }
                //白色容器间的间距为12,最后一个是余白,不需要再添加间距
                frame.Y = i != this.listWhiteFrame.Count - 1 ? defultYY + Application.GetRealHeight(12) : defultYY;
 
                defultYY = frame.Bottom;
            }
        }
 
        /// <summary>
        /// 调整白色容器控件的高度
        /// </summary>
        /// <param name="frameFather">指定白色区域的容器控件</param>
        private void AdjustWhiteFrameHeight(NormalFrameLayout frameFather)
        {
            if (frameFather.ChildrenCount == 1)
            {
                //如果这个容器里面已经没有了开锁方式,则将它置顶,并隐藏
                frameFather.Y = 0;
                frameFather.Visible = false;
            }
            else
            {
                //从新计算它的高度
                var rowLast = frameFather.GetChildren(frameFather.ChildrenCount - 1);
                frameFather.Height = rowLast.Bottom;
                if (rowLast is FrameRowControl)
                {
                    //将它的底线移除掉
                    ((FrameRowControl)rowLast).RemoveBottomLine();
                }
            }
        }
 
        #endregion
 
        #region ■ 初始化开锁方式信息列表_____________
 
        /// <summary>
        /// 初始化开锁方式信息列表
        /// </summary>
        /// <returns></returns>
        private bool InitUnlockMethordInfoFromClound()
        {
            //先初始优化
            this.listUnlockInfo = new List<UnlockMethordInfo>();
 
            for (int i = 0; i < 2; i++)
            {
                var unlockInfo = new UnlockMethordInfo();
                unlockInfo.Id = "MimaKey" + i.ToString();
                unlockInfo.Remark = "密码" + i;
                this.listUnlockInfo.Add(unlockInfo);
            }
            for (int i = 0; i < 2; i++)
            {
                var unlockInfo = new UnlockMethordInfo();
                unlockInfo.Id = "ZhiwenKey" + i.ToString();
                unlockInfo.Remark = "指纹" + i;
                this.listUnlockInfo.Add(unlockInfo);
            }
            return true;
        }
 
        /// <summary>
        /// 开锁方式信息
        /// </summary>
        private class UnlockMethordInfo
        {
            /// <summary>
            /// 数据库主键
            /// </summary>
            public string Id = string.Empty;
            /// <summary>
            /// 密码备注
            /// </summary>
            public string Remark = string.Empty;
            /// <summary>
            /// 用户账号id
            /// </summary>
            public string UserId = string.Empty;
        }
 
        #endregion
 
        #region ■ 显示选择场景弹窗___________________
 
        /// <summary>
        /// 显示选择场景弹窗
        /// </summary>
        /// <param name="unlockInfo">开锁方式</param>
        private void ShowSelectSceneDialog(UnlockMethordInfo unlockInfo)
        {
            if (FunctionList.List.scenes.Count == 0)
            {
                //检测不到可供选择的场景
                HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.NotHadCanSelectScene));
                return;
            }
            var listText = new List<string>();
            var listSelectIndex = new List<int>();
            var listSelect = new List<string>();
            if (this.dicSelectScene.ContainsKey(unlockInfo.Id) == true)
            {
                //当前已经选择了的场景
                listSelect = this.dicSelectScene[unlockInfo.Id];
            }
 
            for (int i = 0; i < FunctionList.List.scenes.Count; i++)
            {
                var info = FunctionList.List.scenes[i];
                listText.Add(info.name);
                if (listSelect.Contains(info.userSceneId) == true)
                {
                    //初始选择
                    listSelectIndex.Add(i);
                }
            }
            //调起弹窗
            var form = new BottomItemSelectControl(FunctionList.List.scenes.Count, Language.StringByID(StringId.SelectScene));
            form.AddRowMenu(listText, listSelectIndex);
            form.FinishOnlyEvent += (div, selectIndex) =>
            {
                if (div == 1)
                {
                    this.dicSelectScene[unlockInfo.Id] = new List<string>();
                    this.dicSelectScene[unlockInfo.Id].Add(FunctionList.List.scenes[selectIndex].userSceneId);
                }
            };
        }
 
        #endregion
 
        #region ■ 删除开锁方式_______________________
 
        /// <summary>
        /// 删除开锁方式
        /// </summary>
        /// <param name="frameFather">父控件</param>
        /// <param name="unlockInfo">开锁信息</param>
        private void DeleteUnlockMethrod(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo)
        {
            //移除指定开锁方式的行控件
            this.RemoveUnlockMethrodRowControl(frameFather, unlockInfo);
 
            //调整白色容器控件的高度
            this.AdjustWhiteFrameHeight(frameFather);
 
            //调整全部白色容器控件的坐标
            this.AdjustAllWhiteFrameLocation();
        }
 
        /// <summary>
        /// 移除指定开锁方式的行控件
        /// </summary>
        /// <param name="frameFather">父控件</param>
        /// <param name="unlockInfo">开锁信息</param>
        private void RemoveUnlockMethrodRowControl(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo)
        {
            //从索引1开始,因为索引0是标题
            for (int i = 1; i < frameFather.ChildrenCount; i++)
            {
                var row = frameFather.GetChildren(i) as FrameRowControl;
                if (row == null || row.MainKey != unlockInfo.Id)
                {
                    //不是它
                    continue;
                }
                //移除掉它
                row.RemoveFromParent();
                break;
            }
            //然后重新整一下全部行的Y轴
            int newYY = frameFather.GetChildren(0).Bottom;
            for (int i = 1; i < frameFather.ChildrenCount; i++)
            {
                var row = frameFather.GetChildren(i) as FrameRowControl;
                if (row == null)
                {
                    //理论上应该不会
                    continue;
                }
                row.Y = newYY;
                newYY = row.Bottom;
            }
        }
 
        #endregion
 
        #region ■ 分配开锁方式_______________________
 
        /// <summary>
        /// 分配开锁方式
        /// </summary>
        /// <param name="frameFather">父控件</param>
        /// <param name="unlockInfo">开锁信息</param>
        private void DistributeUnlockMethord(NormalFrameLayout frameFather, UnlockMethordInfo unlockInfo)
        {
            //如果是未分配的开锁方式,则弹起成员选择窗口
            if (frameFather.MainKey == "NotAssign")
            {
                var listText = new List<string>();
                foreach (var info in this.listMember)
                {
                    listText.Add(info.nickName);
                }
                //调起弹窗
                var form = new BottomItemSelectControl(this.listMember.Count, Language.StringByID(StringId.AssignTo));
                form.AddRowMenu(listText, new List<int>());
                form.FinishOnlyEvent += (div, selectIndex) =>
                {
                    if (div == 1)
                    {
                        //移除指定开锁方式的行控件
                        this.RemoveUnlockMethrodRowControl(frameFather, unlockInfo);
                        //调整白色容器控件的高度
                        this.AdjustWhiteFrameHeight(frameFather);
                        //添加新的开锁方式行控件
                        this.AddNewUnlockMethrodRowControl(this.listMember[selectIndex].childAccountId, unlockInfo);
                        //调整全部白色容器控件的坐标
                        this.AdjustAllWhiteFrameLocation();
                        //调整桌布高度
                        listView.AdjustTableHeight();
                    }
                };
            }
            //如果是成员的,则把它放回未分配
            else
            {
                //移除指定开锁方式的行控件
                this.RemoveUnlockMethrodRowControl(frameFather, unlockInfo);
                //调整白色容器控件的高度
                this.AdjustWhiteFrameHeight(frameFather);
                //添加新的开锁方式行控件到未分配
                this.AddNewUnlockMethrodRowControl("NotAssign", unlockInfo);
                //调整全部白色容器控件的坐标
                this.AdjustAllWhiteFrameLocation();
                //调整桌布高度
                listView.AdjustTableHeight();
            }
        }
 
        /// <summary>
        /// 添加新的开锁方式行控件
        /// </summary>
        /// <param name="i_childId">userId</param>
        /// <param name="unlockInfo">开锁方式信息</param>
        private void AddNewUnlockMethrodRowControl(string i_childId, UnlockMethordInfo unlockInfo)
        {
            NormalFrameLayout fatherFrame = null;
            foreach (var frame in this.listWhiteFrame)
            {
                //获取指定的父控件
                if (frame.MainKey != i_childId) { continue; }
                fatherFrame = frame;
                break;
            }
            //应该不会存在
            if (fatherFrame == null) { return; }
 
            if (fatherFrame.ChildrenCount > 1)
            {
                //先为最后一行画底线
                var lastRow = fatherFrame.GetChildren(fatherFrame.ChildrenCount - 1) as FrameRowControl;
                lastRow?.AddBottomLine();
            }
            else
            {
                //它可以显示出来了
                fatherFrame.Visible = true;
            }
            //向指定的容器添加开锁方式控件
            this.AddUnlockPasswordRowControl(fatherFrame, unlockInfo, true);
            //调整白色容器控件的高度
            this.AdjustWhiteFrameHeight(fatherFrame);
        }
 
        #endregion
 
        #region ■ 下载用户头像_______________________
 
        /// <summary>
        /// 下载用户头像
        /// </summary>
        /// <param name="listIcon">头像控件列表,它的索引和this.listMember一致</param>
        private void DownLoadUserIcon(List<ImageView> listIcon)
        {
            //索引0是当前的登陆账号
            listIcon[0].ImagePath = UserInfo.Current.headImagePagePath;
            HdlThreadLogic.Current.RunThread(() =>
            {
                for (int i = 1; i < this.listMember.Count; i++)
                {
                    var resultData = ImageUtlis.Current.DownHeadImageByImageKey(this.listMember[i].memberHeadIcon, true, this.listMember[i].childAccountRegionUrl);
                    if (this.Parent == null)
                    {
                        //界面已经关闭
                        return;
                    }
                    if (resultData != null && resultData.Length > 0)
                    {
                        int nowIndex = i;
                        HdlThreadLogic.Current.RunMain(() =>
                        {
                            listIcon[nowIndex].ImageBytes = resultData;
                        }, ShowErrorMode.NO);
                    }
                    System.Threading.Thread.Sleep(200);
                }
 
            }, ShowErrorMode.NO);
        }
 
        #endregion
    }
}