wxr
2020-09-11 8df24b0a3dfd5b6f39c5393ef24eab25b70ab858
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
using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    public partial class FunctionPage : FrameLayout
    {
        #region 控件列表
        /// <summary>
        /// 当前窗体
        /// </summary>
        static FrameLayout bodyView;
        /// <summary>
        /// 功能列表集合显示区域
        /// </summary>
        static VerticalScrolViewLayout functionListView;
        #endregion
 
        public FunctionPage()
        {
            bodyView = this;
        }
 
        public void LoadPage(int titleId)
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
 
            /// <summary>
            /// 房间内容显示区域
            /// </summary>
            var roomFloorChangeView = new FrameLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(52),
            };
            bodyView.AddChidren(roomFloorChangeView);
            #region 房间顶部切换显示区域
            /// <summary>
            /// 楼层选择下拉图标
            /// </summary>
            var btnFoorDownIcon = new Button()
            {
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(18),
                UnSelectedImagePath = "Public/DownIcon.png",
            };
            roomFloorChangeView.AddChidren(btnFoorDownIcon);
            /// <summary>
            /// 楼层显示
            /// </summary>
            var btnFoor = new Button()
            {
                X = btnFoorDownIcon.Right,
                Y = Application.GetRealHeight(18),
                Width = Application.GetRealWidth(200),
                Height = Application.GetMinRealAverage(16),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.CenterLeft,
                Text = OnAppConfig.Instance.CurFoor,
            };
            roomFloorChangeView.AddChidren(btnFoor);
            #endregion
 
            functionListView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64 + 52),
                Height = Application.GetRealHeight(603 - 12 - 52),
            };
            bodyView.AddChidren(functionListView);
 
            foreach (var function in DB_ResidenceData.functionList.GetAllFunction())
            {
                if (titleId == StringId.Lights)
                {
                    if (function.functionCategory != FunctionCategory.Light)
                    {
                        continue;
                    }
                }
                if (titleId == StringId.AC)
                {
                    if (function.functionType != FunctionType.AC)
                    {
                        continue;
                    }
                }
                if (titleId == StringId.Curtain)
                {
                    if (function.functionCategory != FunctionCategory.Curtain)
                    {
                        continue;
                    }
                }
                if(titleId == StringId.FloorHeating)
                {
                    if(function.functionType != FunctionType.FloorHeating )
                    {
                        continue;
                    }
                }
                if(titleId == StringId.Electric)
                {
                    if(function.functionType != FunctionType.Socket &&
                        function.functionType != FunctionType.TV &&
                        function.functionType != FunctionType.Fan)
                    {
                        continue;
                    }
                }
                if (titleId == StringId.EnvironmentalScience)
                {
 
                    if (function.functionType != FunctionType.PM25 ||
                    function.functionType != FunctionType.CO2 ||
                    function.functionType != FunctionType.Temp ||
                    function.functionType != FunctionType.TVOC ||
                    function.functionType != FunctionType.Humidity)
                    {
                        continue;
                    }
                }
                if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer)
                {
                    var functionDiv = new FunctionControlZone(function)
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = Application.GetRealHeight(116),
                        Radius = (uint)Application.GetMinRealAverage(12),
                        BorderColor = 0x00FFFFFF,
                        BorderWidth = 1,
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                        Tag = function.sid
                    };
                    functionDiv.LoadFunctionDiv();
                    functionListView.AddChidren(functionDiv);
                }
                else
                {
                    var functionDiv = new FunctionControlZone(function)
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = Application.GetRealHeight(96),
                        Radius = (uint)Application.GetMinRealAverage(12),
                        BorderColor = 0x00FFFFFF,
                        BorderWidth = 1,
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                        Tag = function.sid
                    };
                    functionDiv.LoadFunctionDiv();
                    functionListView.AddChidren(functionDiv);
                }
                functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
            }
 
        }
    }
}