陈嘉乐
2021-03-22 551e82d33c9c23442e0ecd320bcfc752f300d9ef
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs
@@ -1,234 +1,234 @@
using System;
using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI
{
    public partial class EnvironmentalSciencePage
    {
//using System;
//using HDL_ON.Entity;
//using Shared;
//namespace HDL_ON.UI
//{
//    public partial class EnvironmentalSciencePage
//    {
        void LoadEventList()
        {
//        void LoadEventList()
//        {
        }
//        }
       public static void LoadEvent_UpdataStatus(Function updateTemp)
        {
            Application.RunOnMainThread(() =>{
                if (bodyView != null)
                {
                    for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
                    {
                        var sensorTag = updateTemp.sid;
                        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 = updateTemp.GetAttrState(FunctionAttributeKey.Value);
                                        }
                                        else if (tag == "SensorLevel")
                                        {
                                            (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
                                            (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
                                        }
                                    }
                                }
                                else if (btn.GetType() == typeof(ArcSeekBar))
                                {
                                    (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
//       public static void LoadEvent_UpdataStatus(Function updateTemp)
//        {
//            Application.RunOnMainThread(() =>{
//                if (bodyView != null)
//                {
//                    for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
//                    {
//                        var sensorTag = updateTemp.sid;
//                        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 = updateTemp.GetAttrState(FunctionAttributeKey.Value);
//                                        }
//                                        else if (tag == "SensorLevel")
//                                        {
//                                            (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
//                                            (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
//                                        }
//                                    }
//                                }
//                                else if (btn.GetType() == typeof(ArcSeekBar))
//                                {
//                                    (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
                                    (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
                                }
                            }
                        }
                    }
                }
            });
        }
//                                    (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
//                                }
//                            }
//                        }
//                    }
//                }
//            });
//        }
        void LoadEvent_ChangeWeatherIcon(Button btnWeatherIcon)
        {
//        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;
            }
        }
    }
}
//            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;
//            }
//        }
//    }
//}