wxr
2020-06-16 f6fd8acd7c53c44187e70b4709443318a628f4b5
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
using System;
using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI
{
    public partial class EnvironmentalSciencePage
    {
 
        void LoadEventList()
        {
 
        }
 
       public static void LoadEvent_UpdataStatus(Sensor sensor)
        {
            Application.RunOnMainThread(() =>{
                if (bodyView != null)
                {
                    for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
                    {
                        var sensorTag = sensor.sid;
                        if (sensor.bus_Data != null)
                        {
                            sensorTag = ((int)sensor.functionType % 256) + "_" + sensor.bus_Data.SubnetID + "_" + sensor.bus_Data.DeviceID + "_" + sensor.bus_Data.LoopID;
                        }
                        var view = bodyView.sensorListView.GetChildren(i);
                        if (view.GetType() == typeof(FrameLayout))
                        {
                            if(view.Tag.ToString() != sensorTag)
                            {
                                continue;
                            }
                            for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++)
                            {
                                var btn = (view as FrameLayout).GetChildren(j);
                                if (btn.GetType() == typeof(Button))
                                {
                                    if (btn.Tag!=null)
                                    {
                                        var tag = btn.Tag.ToString();
                                        if (tag == "SensorValues")
                                        {
                                            (btn as Button).Text = sensor.values.ToString();
                                        }
                                        else if (tag == "SensorLevel")
                                        {
                                            (btn as Button).TextID = sensor.levelTextList[sensor.curLevel - 1];
                                        }
                                    }
                                }
                                else if (btn.GetType() == typeof(ArcSeekBar))
                                {
                                    (btn as ArcSeekBar).ProgressBarColor = sensor.levelColorList[sensor.curLevel - 1];
                                    (btn as ArcSeekBar).Progress = (96 / sensor.levelColorList.Count) * sensor.curLevel;
                                }
                            }
                        }
                    }
                }
            });
        }
 
        void LoadEvent_ChangeWeatherIcon(Button btnWeatherIcon)
        {
 
            switch (MainPage.cityInfo.weather)
            {
                case "晴":
                case "Sunny":
                case "晴天":
                case "天晴":
                case "Clear":
                case "大部晴朗":
                case "Mostly Sunny":
                case "晴時多雲":
                case "陽光充沛":
                case "Mostly Clear":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/0.png";
                    break;
                case "多云":
                case "Cloudy":
                case "多雲":
                case "少云":
                case "Partly Cloudy":
                case "少雲":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/1.png";
                    break;
                case "阴":
                case "Overcast":
                case "陰天":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/2.png";
                    break;
                case "阵雨":
                case "Showers":
                case "陣雨":
                case "驟雨":
                case "局部阵雨":
                case "Scattered Showers":
                case "局地陣雨":
                case "局部地區性驟雨":
                case "小阵雨":
                case "Light Showers":
                case "小陣雨":
                case "零散驟雨":
                case "强阵雨":
                case "Heavy Showers":
                case "強陣雨":
                case "間中有驟雨":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/3.png";
                    break;
                case "阵雪":
                case "Snow Showers":
                case "陣雪":
                case "驟雪":
                case "小阵雪":
                case "Light Snow Showers":
                case "小陣雪":
                case "零散驟雪":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/13.png";
                    break;
                case "雾":
                case "Fog":
                case "霧":
                case "薄霧":
                case "冻雾":
                case "Freezing Fog":
                case "凍霧":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/18.png";
                    break;
                case "沙尘暴":
                case "Sandstorm":
                case "沙塵暴":
                case "强沙尘暴":
                case "Heavy Sandstorm":
                case "強沙塵暴":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/20.png";
                    break;
                case "浮尘":
                case "Dust":
                case "浮塵":
                case "尘卷风":
                case "Dust Storm":
                case "塵捲風":
                case "扬沙":
                case "Sand":
                case "揚沙":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/29.png";
                    break;
                case "霾":
                case "Haze":
                case "煙霞":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/45.png";
                    break;
                case "雷阵雨":
                case "Thundershower":
                case "雷陣雨":
                case "雷雨":
                case "雷电":
                case "Lightning":
                case "雷電":
                case "雷暴":
                case "Thunderstorm":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/4.png";
                    break;
                case "雷阵雨伴有冰雹":
                case "Thundershower with Hail":
                case "雷陣雨伴有冰雹":
                case "雷雨伴有冰雹":
                case "冰雹":
                case "Hail":
                case "冰针":
                case "Needle Ice":
                case "冰針":
                case "冰粒":
                case "Icy":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/5.png";
                    break;
                case "雨夹雪":
                case "Sleet":
                case "雨夾雪":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/6.png";
                    break;
                case "小雨":
                case "Light Rain":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/3.png";
                    break;
                case "中雨":
                case "Rain":
                case "小到中雨":
                case "雨":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/3.png";
                    break;
                case "大雨":
                case "Heavy Rain":
                case "中到大雨":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/3.png";
                    break;
                case "暴雨":
                case "Rainstorm":
                case "豪雨":
                case "大暴雨":
                case "Heavy Rainstorm":
                case "大豪雨":
                case "特大暴雨":
                case "Extreme Rainstorm":
                case "超大豪雨":
                case "大到暴雨":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/3.png";
                    break;
                case "小雪":
                case "Light Snow":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/13.png";
                    break;
                case "雪":
                case "中雪":
                case "小到中雪":
                case "Snow":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/13.png";
                    break;
                case "大雪":
                case "Heavy Snow":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/13.png";
                    break;
                case "暴雪":
                case "Blizzard":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/13.png";
                    break;
                case "冻雨":
                case "Freezing Rain":
                case "凍雨":
                    btnWeatherIcon.UnSelectedImagePath = "Public/AirIcon/6.png";
                    break;
            }
        }
    }
}