wxr
2020-08-11 2bec9c838d2d688025698de8ec1de401ffd7dd1f
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
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class RoomsManagementPage : FrameLayout
    {
        /// <summary>
        /// 当前窗体
        /// </summary>
        FrameLayout bodyView;
        /// <summary>
        /// 房间列表区域
        /// </summary>
        VerticalScrolViewLayout roomsListView;
 
 
        Action<string, string> skipAddRoomAction;
 
        public RoomsManagementPage()
        {
            bodyView = this;
        }
 
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            LoadEvent_SkipAddRoomPage();
            new TopViewDiv(bodyView, Language.StringByID(StringId.RoomsManagement)).LoadTopView("rooms",skipAddRoomAction);
            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.RoomsManagement), "rooms", skipAddRoomAction);
 
            roomsListView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(590),
            };
            bodyView.AddChidren(roomsListView);
 
            foreach(var room in DB_ResidenceData.residenceData.rooms)
            {
                LoadRoomRow(room);
            }
 
        }
 
        /// <summary>
        /// 加载房间Row
        /// </summary>
        void LoadRoomRow(Room room)
        {
            roomsListView.AddChidren(new Button()
            {
                Height = Application.GetRealHeight(8),
                Tag = room.name+"line",
            });
 
            var roomRow = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Tag = room.name + "row",
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(92),
                Radius = (uint)Application.GetRealWidth(12),
            };
            roomsListView.AddChidren(roomRow);
 
            var btnBg = new Button()
            {
                Y = Application.GetRealHeight(0-(192 - 92) / 2),
                Height = Application.GetRealHeight(192),
                UnSelectedImagePath = room.backgroundImage,
                Radius = (uint)Application.GetRealWidth(12),
            };
            roomRow.AddChidren(btnBg);
 
            var btnShadow = new Button()
            {
                BackgroundColor = 0x19333333,
            };
            roomRow.AddChidren(btnShadow);
 
            var btnRoomName = new Button()
            {
                X = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(266),
                Height = Application.GetRealHeight(26),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = room.floor + " " + room.name,
            };
            roomRow.AddChidren(btnRoomName);
 
            btnShadow.MouseUpEventHandler += (sender, e) => {
                LoadEvent_SkipEditRoomPage(room,btnRoomName,btnBg);
            };
        }
 
    }
}