wei
2021-04-01 ccdff82fac4bcc1067ec806ade5ae897f1214f4d
HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
@@ -25,7 +25,7 @@
        /// <summary>
        /// 空调温度控制控件
        /// </summary>
        ArcSeekBar arcBar;
        DiyArcSeekBar arcBar;
        /// <summary>
        /// 减号按钮
        /// </summary>
@@ -66,7 +66,8 @@
        #endregion
        #region 区域变量
        AC aC;
        AC acTemp = new AC();
        Function function;
        Button btnCollection_Out;
        Button btnFunctionName_Out;
        Button btnFromFloor_Out;
@@ -75,10 +76,10 @@
        /// </summary>
        Action actionRefresh;
        #endregion
        public ACPage(AC func)
        public ACPage(Function func)
        {
            bodyView = this;
            aC = func;
            function = func;
        }
        public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -107,7 +108,7 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = aC.name,
                Text = function.name,
            };
            controlView.AddChidren(btnFunctionName);
@@ -120,7 +121,7 @@
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = aC.GetRoomListName()
                Text = function.GetRoomListName()
            };
            controlView.AddChidren(btnFromFoorAndRoom);
@@ -132,29 +133,41 @@
                Height = Application.GetMinRealAverage(40),
                SelectedImagePath = "Collection/CollectionIcon.png",
                UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
                IsSelected = aC.collection
                IsSelected = function.collect
            };
            controlView.AddChidren(btnCollection);
            //controlView.AddChidren(btnCollection);
            //2020-12-16 如果是成员隐藏收藏功能
            if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
            {
                controlView.AddChidren(btnCollection);
            }
            arcBar = new ArcSeekBar()
            arcBar = new DiyArcSeekBar()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(120),
                Width = Application.GetRealWidth(280),
                Height = Application.GetRealWidth(280),
                Angle = 160,
                ThumbColor = CSS_Color.AuxiliaryColor1,
                ThumbModeFill = true,
                ProgressBarColor = aC.on_off == "on"? CSS_Color.MainColor :CSS_Color.PromptingColor2,
                ThumbRadius = Application.GetRealWidth(12),
                ArcWidthWithDefaultStyle = Application.GetRealWidth(12),
                MinValue = 16,
                MaxValue = 38,
                Progress = aC.curTemp,
                ProgressBarUnitSring = "°C",
                IsClickable = true,
                ProgressTextColor = 0x00000000,
                OpenAngle = 160,
                ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
                ThumbImageHeight = Application.GetRealWidth(50),
                ProgressBarColor = CSS_Color.MainColor,
                OfflineProgressBarColor = CSS_Color.PromptingColor2,
                IsOffline = function.trait_on_off.curValue.ToString() == "off",
                MinValue = function.GetAttribute(FunctionAttributeKey.SetTemp).min,
                MaxValue = function.GetAttribute(FunctionAttributeKey.SetTemp).max,
                //IsClickable = function.trait_on_off.curValue.ToString() == "on",
                ArcColor = CSS_Color.BackgroundColor,
                Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)),
#if __IOS__
                Y = Application.GetRealHeight(120 + 25),
                Width = Application.GetRealWidth(260 - 40),
                Height = Application.GetRealWidth(260 - 40),
                SeekBarPadding = Application.GetRealWidth(8),
#else
                Y = Application.GetRealHeight(120 + 40),
                Width = Application.GetRealWidth(260 - 40),
                Height = Application.GetRealWidth(260 - 40),
                SeekBarPadding = Application.GetRealWidth(7),
#endif
            };
            controlView.AddChidren(arcBar);
@@ -165,9 +178,9 @@
                Width = Application.GetRealWidth(71),
                Height = Application.GetRealWidth(60),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 56,
                TextSize = 50,
                IsBold = true,
                Text = aC.curTemp.ToString(),
                Text = function.GetAttrState(FunctionAttributeKey.SetTemp),
                TextAlignment = TextAlignment.Center,
            };
            controlView.AddChidren(btnTemp);
@@ -177,7 +190,7 @@
                X = btnTemp.Right,
                Y = btnTemp.Y,
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(20),
                Height = Application.GetRealHeight(30),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                IsBold = true,
@@ -190,7 +203,7 @@
            {
                Gravity = Gravity.CenterHorizontal,
                Y = btnTemp.Bottom,
                Width = Application.GetRealWidth(100),
                Width = Application.GetRealWidth(120),
                Height = Application.GetRealHeight(20),
                Text = Language.StringByID(StringId.IndoorTemp) + "20°C",
                TextColor = CSS_Color.PromptingColor1,
@@ -224,7 +237,7 @@
                Y = Application.GetRealHeight(334),
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(30),
                UnSelectedImagePath = aC.curModeImage,
                UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)),
            };
            controlView.AddChidren(btnMode);
@@ -234,24 +247,29 @@
                Y = Application.GetRealHeight(337),
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(30),
                UnSelectedImagePath = aC.curFanImage,
                UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)),
            };
            controlView.AddChidren(btnWindSpeed);
            btnSwitch = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(462),
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealWidth(40),
                Y = Application.GetRealHeight(466),
                Width = Application.GetRealWidth(32),
                Height = Application.GetRealWidth(32),
                UnSelectedImagePath = "Public/PowerClose.png",
                SelectedImagePath = "Public/PowerOpen.png",
                IsSelected = aC.on_off == "on"
                IsSelected = function.trait_on_off.curValue.ToString() == "on"
            };
            controlView.AddChidren(btnSwitch);
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(aC, actionRefresh);
            new TopViewDiv(bodyView,Language.StringByID(StringId.AC)).LoadTopView_FunctionTop(function, actionRefresh);
            new System.Threading.Thread(() =>
            {
                DriverLayer.Control.Ins.SendReadCommand(function);
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 加载修改模式区域
@@ -274,7 +292,6 @@
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(287),
                BackgroundImagePath = "FunctionIcon/AC/DivBg1.png",
                Animate = Animate.DownToUp,
            };
            dialogView.AddChidren(modeChangeView);
@@ -302,28 +319,30 @@
            };
            modeChangeView.AddChidren(btnLine);
            foreach(var m in aC.modeList)
            var modeList = function.GetAttribute(FunctionAttributeKey.Mode).value;
            foreach (var m in modeList)
            {
                Button btnModeIcon = new Button()
                {
                    X = btnTitle.X,
                    Y = Application.GetRealHeight(44 * (aC.modeList.IndexOf(m) + 1) + 10 + 8),
                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
                    Width = Application.GetRealWidth(24),
                    Height = Application.GetRealWidth(24),
                    IsSelected = aC.trait_mode.curValues == m,
                    IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
                };
                modeChangeView.AddChidren(btnModeIcon);
                Button btnModeText = new Button()
                {
                    X = Application.GetRealWidth(12) + btnModeIcon.Right,
                    Y = Application.GetRealHeight(44 * (aC.modeList.IndexOf(m) + 1) + 8),
                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8),
                    Height = Application.GetRealHeight(44),
                    Width = Application.GetRealWidth(70),
                    Width = Application.GetRealWidth(90),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    SelectedTextColor = CSS_Color.MainColor,
                    IsSelected = aC.trait_mode.curValues == m,
                    IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                modeChangeView.AddChidren(btnModeText);
@@ -356,12 +375,12 @@
                        break;
                }
                if(aC.modeList.IndexOf(m) < aC.modeList.Count-1)
                if (modeList.IndexOf(m) < modeList.Count - 1)
                {
                    modeChangeView.AddChidren(new Button()
                    {
                        X = btnTitle.X,
                        Y = btnModeText.Bottom ,
                        Y = btnModeText.Bottom,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS_Color.BackgroundColor,
@@ -396,7 +415,6 @@
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(243),
                BackgroundImagePath = "FunctionIcon/AC/DivBg2.png",
                Animate = Animate.DownToUp,
            };
            dialogView.AddChidren(modeChangeView);
@@ -424,28 +442,30 @@
            };
            modeChangeView.AddChidren(btnLine);
            foreach (var m in aC.fan_List)
            var modeList = function.GetAttribute(FunctionAttributeKey.FanSpeed).value;
            foreach (var m in modeList)
            {
                Button btnFanIcon = new Button()
                {
                    X = btnTitle.X,
                    Y = Application.GetRealHeight(44 * (aC.fan_List.IndexOf(m) + 1) + 10 + 8),
                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
                    Width = Application.GetRealWidth(24),
                    Height = Application.GetRealWidth(24),
                    IsSelected = aC.trait_fan.curValues.ToString() == m,
                    IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
                };
                modeChangeView.AddChidren(btnFanIcon);
                Button btnFanText = new Button()
                {
                    X = Application.GetRealWidth(12) + btnFanIcon.Right,
                    Y = Application.GetRealHeight(44 * (aC.fan_List.IndexOf(m) + 1) + 8),
                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8),
                    Height = Application.GetRealHeight(44),
                    Width = Application.GetRealWidth(70),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    SelectedTextColor = CSS_Color.MainColor,
                    IsSelected = aC.trait_fan.curValues.ToString() == m,
                    IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                modeChangeView.AddChidren(btnFanText);
@@ -473,7 +493,7 @@
                        break;
                }
                if (aC.modeList.IndexOf(m) < aC.modeList.Count - 1)
                if (modeList.IndexOf(m) < modeList.Count - 1)
                {
                    modeChangeView.AddChidren(new Button()
                    {
@@ -489,7 +509,5 @@
            dialog.Show();
        }
    }
}
}