wxr
2022-11-15 02498f7744e6fdc413e518f96b25f3635540dc6b
HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
@@ -21,6 +21,7 @@
        Function function;
        uint curColor;
        string colorString;
        string imageFolder = "blue";
@@ -36,24 +37,31 @@
                int setTempValue = 0;
                int.TryParse(temp.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out setTempValue);
                double dd = 0;
                double.TryParse(temp.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out dd);
                setTempValue = Convert.ToInt32(dd);
                if (setTempValue != 0)
                    bodyView.btnSetTempValues.Text = setTempValue.ToString();
                bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10);
                int progress = 0;
                int.TryParse(temp.GetAttrState(FunctionAttributeKey.SetTemp), out progress);
                bodyView.tempBar.Progress = progress + 16;
                //int progress = 0;
                //int.TryParse(temp.GetAttrState(AcstSub_AttrEnum.set_temp.ToString()), out progress);
                if (bodyView.tempBar.Progress != setTempValue - 16)
                    bodyView.tempBar.Progress = setTempValue - 16;
                if(temp.trait_on_off.curValue.ToString() == "on")
                {
                    bodyView.btnPowerControl.IsSelected = true;
                    bodyView.tempBar.Enable = false;
                    bodyView.tempBar.ProgressBarColor = bodyView.curColor;
                    //bodyView.tempBar.IsClickable = function.trait_on_off.curValue.ToString() == "off",
                    //bodyView.tempBar.IsOffline = false;
                }
                else
                {
                    bodyView.btnPowerControl.IsSelected = false;
                    bodyView.tempBar.Enable = true;
                    bodyView.tempBar.ProgressBarColor = CSS_Color.DividingLineColor;
                    //bodyView.tempBar.IsOffline = true;
                }
            });
@@ -66,21 +74,24 @@
            switch (imageFolder)
            {
                case "blue":
                    curColor = CSS.CSS_Color.MainColor;
                    curColor = CSS_Color.MainColor;
                    colorString = "#4484F4";
                    break;
                case "orange":
                    curColor = 0xFFFFB848;
                    colorString = "#FFB848";
                    break;
                case "purple":
                    curColor = 0xFF9175F3;
                    colorString = "#9175F3";
                    break;
            }
            bodyView = this;
        }
        public void LoadPage()
        public void LoadPage(Action action)
        {
            new TopViewDiv(bodyView, function.GetRoomListName()).LoadTopView();
            new TopViewDiv(bodyView, function.name).LoadTopView_FunctionTop(function,action);
            var contentView = new FrameLayout()
            {
@@ -121,9 +132,9 @@
                TextSize = 30,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.TopRight,
                Text = "---",
                Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString(),"---"),
            };
            btnTempValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString());
            //btnTempValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString());
            btnTempValues.Width = btnTempValues.GetTextWidth();
            btnTempValues.Gravity = Gravity.CenterHorizontal;
            tempValuesView.AddChidren(btnTempValues);
@@ -157,10 +168,9 @@
                IsBold = true,
                TextSize = 30,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                Text = "---",
                Text = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString(),"---"),
                TextAlignment = TextAlignment.TopRight,
            };
            btnHumiValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString());
            btnHumiValues.Width = btnTempValues.GetTextWidth();
            btnHumiValues.Gravity = Gravity.CenterHorizontal;
            humiValuesView.AddChidren(btnHumiValues);
@@ -179,7 +189,7 @@
            EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
                var page = new AcstSubHistoryPage(function);
                var page = new AcstSubHistoryPage(function, colorString);
                MainPage.BasePageView.AddChidren(page);
                page.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -191,24 +201,27 @@
            #endregion
            int setTempValue = 0;
            string setTempStr = "--";
            double dd = 0;
            double.TryParse(function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out dd);
            setTempValue = Convert.ToInt32(dd);
            if (setTempValue != 0)
                setTempStr = setTempValue.ToString();
            btnSetTempValues = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                X = Application.GetRealWidth((375 - 77 -30)/2),
                Y = Application.GetRealHeight(260),
                Width = Application.GetRealWidth(71),
                Width = Application.GetRealWidth(73),
                Height = Application.GetRealHeight(90),
                TextAlignment = TextAlignment.TopRight,
                TextAlignment = TextAlignment.TopCenter,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                IsBold = true,
                TextSize = 60,
                Text = function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--")
                Text = setTempStr
            };
            contentView.AddChidren(btnSetTempValues);
            int setTempValue = 0;
            int.TryParse(function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out setTempValue);
            if (setTempValue != 0)
                btnSetTempValues.Text = setTempValue.ToString();
            bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10);
            //bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10);
@@ -255,12 +268,13 @@
                ThumbImageHeight = Application.GetRealHeight(51),
                ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? curColor : CSS_Color.DividingLineColor,
                MaxValue = 14,
                Progress = progress + 16,
                Progress = progress - 16,
                SeekBarPadding = Application.GetRealWidth(20),
                IsProgressTextShow = false,
                ProgressChangeDelayTime = 0,
                Enable = function.trait_on_off.curValue.ToString() == "off",
                //IsOffline = function.trait_on_off.curValue.ToString() == "off",
                //IsClickable = function.trait_on_off.curValue.ToString() == "off",
                //Enable = function.trait_on_off.curValue.ToString() == "off",
                //IsOffline = true,// function.trait_on_off.curValue.ToString() == "off",
            };
            contentView.AddChidren(tempBar);
            tempBar.OnProgressChangedEvent = (sender, e) => {
@@ -269,7 +283,7 @@
            tempBar.OnStopTrackingTouchEvent = (sender, e) => {
                new System.Threading.Thread(() => {
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.SetTemp, e.ToString());
                    d.Add(FunctionAttributeKey.SetTemp, (e+16).ToString());
                    Control.Ins.SendWriteCommand(function, d);
                })
                { IsBackground = true }.Start();
@@ -288,8 +302,6 @@
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            contentView.AddChidren(btnMaxValuesText);