From cae4d4b5b508a666fbd0dff3c2a981fdff841bc8 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 30 三月 2023 13:10:33 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into wjc

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs |  317 +++++++++++++++++++++++++++-------------------------
 1 files changed, 165 insertions(+), 152 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
index 7bed343..a10b239 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
@@ -69,7 +69,7 @@
             {
                 Y = Application.GetRealHeight(64),
                 Height = Application.GetRealHeight(600),
-                ScrollEnabled = false
+                ScrollEnabled = sensorList.Count > 6
             };
             bodyView.AddChidren(contentView);
 
@@ -657,165 +657,178 @@
             bool initTitleButton = true;
 
             int index = 1;
-            foreach (var tempSensor in sensorList)
+            try
             {
-                if(index > 6)
+                new System.Threading.Thread(() =>
                 {
-                    break;
-                }
-                if (tempSensor.sid == function.sid)
-                {
-                    continue;
-                }
-                if (tempSensor.spk != function.spk)
-                {
-                    continue;
-                }
-                contentView.ScrollEnabled = true;
-
-                if (initTitleButton)
-                {
-                    Button btnOthreTitle = new Button()
+                    foreach (var tempSensor in sensorList)
                     {
-                        X = Application.GetRealWidth(16),
-                        Width = Application.GetRealWidth(200),
-                        Height = Application.GetRealWidth(38),
-                        TextAlignment = TextAlignment.CenterLeft,
-                        TextColor = CSS_Color.FirstLevelTitleColor,
-                        TextSize = CSS_FontSize.SubheadingFontSize,
-                        TextID = StringId.OtherArea,
-                    };
-                    contentView.AddChidren(btnOthreTitle);
-                    initTitleButton = false;
-                }
+                        if (index >= 6)
+                        {
+                            break;
+                        }
+                        if (tempSensor.sid == function.sid)
+                        {
+                            continue;
+                        }
+                        if (tempSensor.spk != function.spk)
+                        {
+                            continue;
+                        }
 
-                #region 鍏跺畠浼犳劅鍣ㄤ俊鎭爮
-                FrameLayout otherInfoView = new FrameLayout()
-                {
-                    Gravity = Gravity.CenterHorizontal,
-                    Width = Application.GetRealWidth(343),
-                    Height = Application.GetRealWidth(100),
-                    BackgroundColor = CSS_Color.MainBackgroundColor,
-                    Radius = (uint)Application.GetRealWidth(12),
-                    BorderColor = 0x00000000,
-                    BorderWidth = 0,
-                };
-                contentView.AddChidren(otherInfoView);
-
-                Button btnTipColor1 = new Button()
-                {
-                    X = Application.GetRealWidth(8),
-                    Y = Application.GetRealWidth(16),
-                    Width = Application.GetRealWidth(12),
-                    Height = Application.GetRealWidth(12),
-                    BackgroundColor = tipColorList[index++],
-                    Radius = (uint)Application.GetRealWidth(2),
-                    BorderWidth = 0,
-                    BorderColor = 0x00000000,
-                };
-                otherInfoView.AddChidren(btnTipColor1);
-
-                Button btnSensorName = new Button()
-                {
-                    X = Application.GetRealWidth(28),
-                    Y = Application.GetRealWidth(10),
-                    Width = Application.GetRealWidth(250),
-                    Height = Application.GetRealWidth(24),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = CSS_Color.FirstLevelTitleColor,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    Text = function.name,
-                    IsBold = true,
-                };
-                otherInfoView.AddChidren(btnSensorName);
-
-                Button btnFromFoorAndRoom1 = new Button()
-                {
-                    X = Application.GetRealWidth(16),
-                    Y = btnSeltSensorName.Bottom,
-                    Width = Application.GetRealWidth(270),
-                    Height = Application.GetRealHeight(21),
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                    Text = tempSensor.GetRoomListName()
-                };
-                otherInfoView.AddChidren(btnFromFoorAndRoom1);
-
-                var btnSetting1 = new Button()
-                {
-                    X = Application.GetRealWidth(291),
-                    Y = Application.GetRealWidth(6),
-                    Width = Application.GetMinRealAverage(32),
-                    Height = Application.GetMinRealAverage(32),
-                    UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
-                };
-                otherInfoView.AddChidren(btnSetting1);
-
-                btnSetting1.MouseUpEventHandler = (sender, e) =>
-                {
-                    Action backAction = () =>
-                    {
-                        MainPage.Log("45678i");
                         Application.RunOnMainThread(() =>
                         {
-                            btnSeltSensorName.Text = tempSensor.name;
+                            if (initTitleButton)
+                            {
+                                Button btnOthreTitle = new Button()
+                                {
+                                    X = Application.GetRealWidth(16),
+                                    Width = Application.GetRealWidth(200),
+                                    Height = Application.GetRealWidth(38),
+                                    TextAlignment = TextAlignment.CenterLeft,
+                                    TextColor = CSS_Color.FirstLevelTitleColor,
+                                    TextSize = CSS_FontSize.SubheadingFontSize,
+                                    TextID = StringId.OtherArea,
+                                };
+                                contentView.AddChidren(btnOthreTitle);
+                                initTitleButton = false;
+                            }
+
+                            #region 鍏跺畠浼犳劅鍣ㄤ俊鎭爮
+                            FrameLayout otherInfoView = new FrameLayout()
+                            {
+                                Gravity = Gravity.CenterHorizontal,
+                                Width = Application.GetRealWidth(343),
+                                Height = Application.GetRealWidth(100),
+                                BackgroundColor = CSS_Color.MainBackgroundColor,
+                                Radius = (uint)Application.GetRealWidth(12),
+                                BorderColor = 0x00000000,
+                                BorderWidth = 0,
+                            };
+                            contentView.AddChidren(otherInfoView);
+
+                            Button btnTipColor1 = new Button()
+                            {
+                                X = Application.GetRealWidth(8),
+                                Y = Application.GetRealWidth(16),
+                                Width = Application.GetRealWidth(12),
+                                Height = Application.GetRealWidth(12),
+                                BackgroundColor = tipColorList[index++],
+                                Radius = (uint)Application.GetRealWidth(2),
+                                BorderWidth = 0,
+                                BorderColor = 0x00000000,
+                            };
+                            otherInfoView.AddChidren(btnTipColor1);
+
+                            Button btnSensorName = new Button()
+                            {
+                                X = Application.GetRealWidth(28),
+                                Y = Application.GetRealWidth(10),
+                                Width = Application.GetRealWidth(250),
+                                Height = Application.GetRealWidth(24),
+                                TextAlignment = TextAlignment.CenterLeft,
+                                TextColor = CSS_Color.FirstLevelTitleColor,
+                                TextSize = CSS_FontSize.TextFontSize,
+                                Text = function.name,
+                                IsBold = true,
+                            };
+                            otherInfoView.AddChidren(btnSensorName);
+
+                            Button btnFromFoorAndRoom1 = new Button()
+                            {
+                                X = Application.GetRealWidth(16),
+                                Y = btnSeltSensorName.Bottom,
+                                Width = Application.GetRealWidth(270),
+                                Height = Application.GetRealHeight(21),
+                                TextColor = CSS_Color.PromptingColor1,
+                                TextAlignment = TextAlignment.CenterLeft,
+                                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                                Text = tempSensor.GetRoomListName()
+                            };
+                            otherInfoView.AddChidren(btnFromFoorAndRoom1);
+
+                            var btnSetting1 = new Button()
+                            {
+                                X = Application.GetRealWidth(291),
+                                Y = Application.GetRealWidth(6),
+                                Width = Application.GetMinRealAverage(32),
+                                Height = Application.GetMinRealAverage(32),
+                                UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
+                            };
+                            otherInfoView.AddChidren(btnSetting1);
+
+                            btnSetting1.MouseUpEventHandler = (sender, e) =>
+                            {
+                                Action backAction = () =>
+                                {
+                                    MainPage.Log("45678i");
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        btnSeltSensorName.Text = tempSensor.name;
+                                    });
+                                };
+                                var infoView = new FunctionBaseInfoSetPage(tempSensor, backAction);
+                                MainPage.BasePageView.AddChidren(infoView);
+                                infoView.LoadPage();
+                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                            };
+
+                            Button btnSensorValue = new Button()
+                            {
+                                X = Application.GetRealWidth(16),
+                                Y = Application.GetRealWidth(47),
+                                Width = Application.GetRealWidth(200),
+                                Height = Application.GetRealWidth(43),
+                                TextAlignment = TextAlignment.CenterLeft,
+                                TextColor = CSS_Color.FirstLevelTitleColor,
+                                IsBold = true,
+                                TextSize = CSS_FontSize.HeadlineFontSize,
+                            };
+                            otherInfoView.AddChidren(btnSensorValue);
+
+                            var btnShowData1 = new Button()
+                            {
+                                X = Application.GetRealWidth(291),
+                                Y = Application.GetRealWidth(62),
+                                Width = Application.GetMinRealAverage(32),
+                                Height = Application.GetMinRealAverage(32),
+                                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/DiagramIcon.png",
+                                SelectedImagePath = "FunctionIcon/EnvironmentalScience/DiagramIconOn.png",
+                            };
+                            otherInfoView.AddChidren(btnShowData1);
+                            btnShowData1.MouseUpEventHandler = (sender, e) =>
+                            {
+                                btnShowData1.IsSelected = !btnShowData1.IsSelected;
+                                if (btnShowData1.IsSelected)
+                                {
+                                    if (!showFunctions.Contains(tempSensor))
+                                    {
+                                        showFunctions.Add(tempSensor);
+                                    }
+                                }
+                                else
+                                {
+                                    if (showFunctions.Contains(tempSensor))
+                                    {
+                                        showFunctions.Remove(tempSensor);
+                                    }
+                                }
+                                LoadMothed_GetSensorHistoryData();
+                            };
+                            #endregion
+
+                            contentView.AddChidren(new Button()
+                            {
+                                Height = Application.GetRealHeight(12),
+                            });
                         });
-                    };
-                    var infoView = new FunctionBaseInfoSetPage(tempSensor, backAction);
-                    MainPage.BasePageView.AddChidren(infoView);
-                    infoView.LoadPage();
-                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                };
-
-                Button btnSensorValue = new Button()
-                {
-                    X = Application.GetRealWidth(16),
-                    Y = Application.GetRealWidth(47),
-                    Width = Application.GetRealWidth(200),
-                    Height = Application.GetRealWidth(43),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = CSS_Color.FirstLevelTitleColor,
-                    IsBold = true,
-                    TextSize = CSS_FontSize.HeadlineFontSize,
-                };
-                otherInfoView.AddChidren(btnSensorValue);
-
-                var btnShowData1 = new Button()
-                {
-                    X = Application.GetRealWidth(291),
-                    Y = Application.GetRealWidth(62),
-                    Width = Application.GetMinRealAverage(32),
-                    Height = Application.GetMinRealAverage(32),
-                    UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/DiagramIcon.png",
-                    SelectedImagePath = "FunctionIcon/EnvironmentalScience/DiagramIconOn.png",
-                };
-                otherInfoView.AddChidren(btnShowData1);
-                btnShowData1.MouseUpEventHandler = (sender, e) => {
-                    btnShowData1.IsSelected = !btnShowData1.IsSelected;
-                    if (btnShowData1.IsSelected)
-                    {
-                        if (!showFunctions.Contains(tempSensor))
-                        {
-                            showFunctions.Add(tempSensor);
-                        }
+                        System.Threading.Thread.Sleep(50);
                     }
-                    else
-                    {
-                        if (showFunctions.Contains(tempSensor))
-                        {
-                            showFunctions.Remove(tempSensor);
-                        }
-                    }
-                    LoadMothed_GetSensorHistoryData();
-                };
-                #endregion
-
-                contentView.AddChidren(new Button()
-                {
-                    Height = Application.GetRealHeight(12),
-                });
-
+                }).Start();
+            }
+            catch(Exception ex)
+            {
+                MainPage.Log($"鍔犺浇浼犳劅鍣ㄥ紓甯竫x:{ex.Message}");
             }
             #endregion
             new TopViewDiv(bodyView, Language.StringByID(sensorTemp.GetFunctionTypeNameId(function.spk))).LoadTopView();

--
Gitblit v1.8.0