wxr
2020-03-13 171bf03f3664226eeff2b20ee9bd2e914b63a17d
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
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class ChooseRoomPage : FrameLayout
    {
        #region 控件列表
        FrameLayout bodyView;
        /// <summary>
        /// 内容加载区域
        /// </summary>
        VerticalScrolViewLayout contentView;
 
        Button btnChooseAll;
 
        #endregion
 
        #region 局部变量
 
        Function function;
        /// <summary>
        /// 回调事件
        /// </summary>
        Action backAction;
        #endregion
 
        public ChooseRoomPage(Function func,Action action)
        {
            bodyView = this;
            function = func;
            backAction = action;
        }
 
        /// <summary>
        /// 加载页面
        /// </summary>
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(backAction);
 
            contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(667 - 64),
            };
            bodyView.AddChidren(contentView);
 
            var allRoomView = new FrameLayout()
            {
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(allRoomView);
 
            Button btnAllRoomText = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(280),
                TextID = StringId.All,
                TextSize= CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
            };
            allRoomView.AddChidren(btnAllRoomText);
 
            btnChooseAll = new Button()
            {
                X = Application.GetRealWidth(331),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/ChooseIcon.png",
                SelectedImagePath = "Public/ChooseOnIcon.png",
                IsSelected = true
            };
            allRoomView.AddChidren(btnChooseAll);
 
            foreach(var room in DB_ResidenceData.residenceData.rooms)
            {
                var roomView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(50),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Tag = "row"
                };
                contentView.AddChidren(roomView);
 
                var btnLine = new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Height = Application.GetMinReal(1),
                    Width = Application.GetRealWidth(343),
                    BackgroundColor = CSS_Color.DividingLineColor,
                };
                roomView.AddChidren(btnLine);
 
                Button btnRoomText = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(280),
                    TextSize = CSS_FontSize.SubheadingFontSize,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = room.floor + "  " + room.name,
                };
                roomView.AddChidren(btnRoomText);
 
                Button btnChoose = new Button()
                {
                    X = Application.GetRealWidth(331),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(28),
                    Height = Application.GetMinRealAverage(28),
                    UnSelectedImagePath = "Public/ChooseIcon.png",
                    SelectedImagePath = "Public/ChooseOnIcon.png",
                    IsSelected = function.roomIdList.Contains(room.sid),
                    Tag = "ChooseIcon"
                };
                roomView.AddChidren(btnChoose);
                btnChoose.MouseUpEventHandler = (sender, e) => {
                    btnChoose.IsSelected = !btnChoose.IsSelected;
                    LoadEvent_RoomSelected(room, btnChoose.IsSelected);
                };
 
                if (!function.roomIdList.Contains(room.sid) && btnChooseAll.IsSelected)
                {
                    btnChooseAll.IsSelected = false;
                }
 
            }
 
            LoadEventLoad();
        }
    }
}