wxr
2023-06-06 592974441a4df95fffd9167c90192da1a390b1c2
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,161 +657,178 @@
            bool initTitleButton = true;
            int index = 1;
            foreach (var tempSensor in sensorList)
            try
            {
                if (tempSensor.sid == function.sid)
                new System.Threading.Thread(() =>
                {
                    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($"加载传感器异常xx:{ex.Message}");
            }
            #endregion
            new TopViewDiv(bodyView, Language.StringByID(sensorTemp.GetFunctionTypeNameId(function.spk))).LoadTopView();