黄学彪
2019-10-10 2ed75b8b337048e5d75e6d9ec8307633134f02fd
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
using System;
using Shared.Common;
namespace Shared.Phone.Device.Category
{
    public class CategorySceneSelectRoomList:FrameLayout
    {
        public  Action<Shared.Common.Room> SelectedRoomAction;
        public CategorySceneSelectRoomList()
        {
            BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor;
        }
        public override void RemoveFromParent()
        {
            base.RemoveFromParent();
        }
        public void Show()
        {
            #region topview
            var topBGView = new FrameLayout()
            {
                Height = Application.GetRealHeight(CommonPage.Navigation_Height),
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
            };
            AddChidren(topBGView);
            var topView = new FrameLayout()
            {
                Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),
                Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,
            };
            AddChidren(topView);
 
            var title = new Button()
            {
                TextID = R.MyInternationalizationString.SelectRoom,
                TextSize = 20,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                Width = Application.GetRealWidth(CommonPage.AppRealWidth - 500),
                Gravity = Gravity.CenterHorizontal
            };
            topView.AddChidren(title);
 
            var back = new Device.CommonForm.BackButton() { };
            topView.AddChidren(back);
 
            back.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
 
            #endregion
            #region midFL
            var roomBodyView = new VerticalScrolViewLayout()
            {
                Y=topView.Bottom,
                Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
            };
            AddChidren(roomBodyView);
          
            foreach (var roomFilePath in Config.Instance.Home.RoomFilePathList)
            {
                var room = Shared.Common.Room.GetRoomByFilePath(roomFilePath);
                if (room == null)
                {
                    continue;
                }
 
                var roomRowView = new RowLayout()
                {
                    Height = Application.GetRealHeight(600),
                    BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
                    LineColor = ZigbeeColor.Current.GXCBackgroundColor
                };
                roomBodyView.AddChidren(roomRowView);
 
                var backGroundBtn = new Button()
                {
                    Y = Application.GetRealHeight(50),
                    Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2),
                    Height = Application.GetRealHeight(550),
                    Gravity=Gravity.CenterHorizontal,
                    UnSelectedImagePath = room.BackgroundImage,
                    Radius = CommonPage.BigFormRadius,
                };
                roomRowView.AddChidren(backGroundBtn);
 
                var hardBlackBG = new FrameLayout()
                {
                    Y = Application.GetRealHeight(50),
                    Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2),
                    Height = Application.GetRealHeight(550),
                    Gravity = Gravity.CenterHorizontal,
                    Radius = CommonPage.BigFormRadius,
                    BackgroundColor = ZigbeeColor.Current.GXCBlack70Color
                };
                roomRowView.AddChidren(hardBlackBG);
 
                var btnRoomName = new Button()
                {
                    Width = Application.GetRealWidth(500),
                    Height = Application.GetRealHeight(200),
                    Text = room.Name,
                    TextAlignment = TextAlignment.Center,
                    TextSize = 25,
                    TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
                    Gravity = Gravity.Center
                };
                roomRowView.AddChidren(btnRoomName);
 
                EventHandler<MouseEventArgs> selectZoneEventHandler = (sender, e) =>
                {
                    SelectedRoomAction?.Invoke(room);
                    this.RemoveFromParent();
                };
                hardBlackBG.MouseUpEventHandler += selectZoneEventHandler;
                btnRoomName.MouseUpEventHandler += selectZoneEventHandler;
            }
            #endregion
        }
    }
}