wei
2021-04-01 ccdff82fac4bcc1067ec806ade5ae897f1214f4d
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs
@@ -29,7 +29,15 @@
        /// <summary>
        /// 调光控件
        /// </summary>
        WaveSeekBar dimmerBar;
        WaveSeekBarOn dimmerBar;
        /// <summary>
        /// 亮度显示按钮
        /// </summary>
        Button btnBrightnessText;
        /// <summary>
        /// 渐变时间修改
        /// </summary>
        DiyImageSeekBar barFadeTime;
        /// <summary>
        /// 开关按钮
        /// </summary>
@@ -37,7 +45,8 @@
        #endregion
        #region 区域变量
        Light light;
        Light lightTemp = new Light();
        Function function;
        Button btnCollection_Out;
        Button btnFunctionName_Out;
        Button btnFromFloor_Out;
@@ -54,10 +63,10 @@
            bodyView = null;
        }
        public DimmerPage(Light func)
        public DimmerPage(Function func)
        {
            bodyView = this;
            light = func;
            function = func;
        }
        public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -66,8 +75,8 @@
            btnFunctionName_Out = btnFunctionNameOut;
            btnFromFloor_Out = btnFromFloorOut;
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null);
            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light);
            //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(function,null);
            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), function);
            controlView = new FrameLayout()
            {
@@ -88,7 +97,7 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = light.name,
                Text = function.name,
            };
            controlView.AddChidren(btnFunctionName);
@@ -101,7 +110,7 @@
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = light.GetRoomListName()
                Text = function.GetRoomListName()
            };
            controlView.AddChidren(btnFromFoorAndRoom);
@@ -113,27 +122,49 @@
                Height = Application.GetMinRealAverage(40),
                SelectedImagePath = "Collection/CollectionIcon.png",
                UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
                IsSelected = light.collection
                IsSelected = function.collect
            };
            controlView.AddChidren(btnCollection);
            //controlView.AddChidren(btnCollection);
            //2020-12-16 如果是成员隐藏收藏功能
            if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
            {
                controlView.AddChidren(btnCollection);
            }
            dimmerBar = new WaveSeekBar()
            dimmerBar = new WaveSeekBarOn()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(74 + 16),
                Width = Application.GetRealWidth(168 - 40),
                Height = Application.GetRealHeight(288 - 16 - 16),
                WaveColor = light.on_off == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor,
                WaveBorderColor = CSS_Color.PromptingColor2,
                BorderColor = 0x00000000,
                CornerRadius = Application.GetRealWidth(1),
                CornerRadius = Application.GetRealWidth(30),
                BorderWidth = 0,
                WavePadding = Application.GetRealWidth(-5),
                BackgroundColor = CSS_Color.BackgroundColor,
                Radius = (uint)Application.GetRealWidth(40),
                Progress = light.brightness,
                Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)),
                IsProgressTextShow = false,
            };
            controlView.AddChidren(dimmerBar);
            if(function.trait_on_off.curValue.ToString() == "on")
            {
                dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
            }
            else
            {
                dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
            }
            dimmerBar.Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness));
            btnBrightnessText = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y =( (100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) /100)+ Application.GetRealWidth(40),
                Width = Application.GetRealWidth(56),
                Height = Application.GetRealWidth(46),
                UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png",
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%",
            };
            controlView.AddChidren(btnBrightnessText);
            #region 渐变时间调节
            var btnGradualChangeText = new Button()
@@ -146,6 +177,8 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.SpeedOfChange,
                Visible = function.GetAttribute(FunctionAttributeKey.FadeTime)!= null,
                Enable = function.GetAttribute(FunctionAttributeKey.FadeTime)!= null,
            };
            controlView.AddChidren(btnGradualChangeText);
@@ -159,10 +192,12 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
                Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
            };
            controlView.AddChidren(btnGradualChangeMinValuesText);
            var barGradualChange = new DiyImageSeekBar()
            barFadeTime = new DiyImageSeekBar()
            {
                X = btnGradualChangeMinValuesText.Right,
                Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
@@ -176,13 +211,16 @@
                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                ProgressBarUnitSring = "s",
                MaxValue = 10,
                Progress = 0,
                Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.FadeTime)),
                SeekBarPadding = Application.GetRealWidth(20),
                Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
                Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
            };
            controlView.AddChidren(barGradualChange);
            controlView.AddChidren(barFadeTime);
            var btnGradualChangeMaxValuesText = new Button()
            {
                X = barGradualChange.Right,
                X = barFadeTime.Right,
                Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
                Width = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(21),
@@ -190,6 +228,8 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
                Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
            };
            controlView.AddChidren(btnGradualChangeMaxValuesText);
            #endregion
@@ -202,15 +242,18 @@
                Height = Application.GetMinRealAverage(40),
                UnSelectedImagePath = "Public/PowerClose.png",
                SelectedImagePath = "Public/PowerOpen.png",
                IsSelected = light.on_off == "on",
                //Tag =
                IsSelected = function.trait_on_off.curValue.ToString() == "on",
            };
            controlView.AddChidren(btnSwitch);
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light, actionRefresh);
            new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh);
            new System.Threading.Thread(() =>
            {
                DriverLayer.Control.Ins.SendReadCommand(function);
            })
            { IsBackground = true }.Start();
        }