wei
2020-12-11 488efb508eb0648773fe7b68e810e04bcd7ca075
HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
@@ -9,7 +9,7 @@
    {
        #region 控件集合
        FrameLayout bodyView;
        static ACPage bodyView;
        /// <summary>
        /// 功能名称按钮
        /// </summary>
@@ -23,9 +23,9 @@
        /// </summary>
        Button btnCollection;
        /// <summary>
        /// 窗帘背景icon
        /// 空调温度控制控件
        /// </summary>
        ArcSeekBar arcBar;
        DiyArcSeekBar arcBar;
        /// <summary>
        /// 减号按钮
        /// </summary>
@@ -46,7 +46,7 @@
        /// <summary>
        /// 模式按钮
        /// </summary>
        Button btnPattern;
        Button btnMode;
        /// <summary>
        /// 风俗按钮
        /// </summary>
@@ -55,10 +55,18 @@
        /// 电源按钮
        /// </summary>
        Button btnSwitch;
        /// <summary>
        /// 修改模式信息区域
        /// </summary>
        //FrameLayout modeChangeView;
        /// <summary>
        /// 修改风速信息区域
        /// </summary>
        //FrameLayout fanChangeView;
        #endregion
        #region 区域变量
        Function function;
        AC aC;
        Button btnCollection_Out;
        Button btnFunctionName_Out;
        Button btnFromFloor_Out;
@@ -67,10 +75,10 @@
        /// </summary>
        Action actionRefresh;
        #endregion
        public ACPage(Function func)
        public ACPage(AC func)
        {
            bodyView = this;
            function = func;
            aC = func;
        }
        public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -99,7 +107,7 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = function.name,
                Text = aC.name,
            };
            controlView.AddChidren(btnFunctionName);
@@ -112,7 +120,7 @@
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = function.GetRoomListName()
                Text = aC.GetRoomListName()
            };
            controlView.AddChidren(btnFromFoorAndRoom);
@@ -124,29 +132,43 @@
                Height = Application.GetMinRealAverage(40),
                SelectedImagePath = "Collection/CollectionIcon.png",
                UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
                IsSelected = function.collection
                IsSelected = aC.collect
            };
            controlView.AddChidren(btnCollection);
            arcBar = new ArcSeekBar()
            arcBar = new DiyArcSeekBar()
            {
#if __IOS__
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(120),
                Width = Application.GetRealWidth(280),
                Height = Application.GetRealWidth(280),
                Angle = 160,
                ThumbColor = CSS_Color.AuxiliaryColor1,
                ThumbModeFill = true,
                ProgressBarColor = CSS_Color.MainColor,
                ThumbRadius = Application.GetRealWidth(14),
                ArcWidthWithDefaultStyle = Application.GetRealWidth(12),
                Y = Application.GetRealHeight(120+25),
                Width = Application.GetRealWidth(260-40),
                Height = Application.GetRealWidth(260-40),
                OpenAngle = 160,
                ThumbImagePath = aC.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
                ThumbImageHeight = Application.GetRealWidth(50),
                ProgressBarColor = aC.trait_on_off.curValue.ToString() == "on"? CSS_Color.MainColor :CSS_Color.PromptingColor2,
                MinValue = 16,
                MaxValue = 38,
                Progress = 16,
                ProgressBarUnitSring = "°C",
                IsClickable = true,
                ProgressTextColor = 0x00000000,
                Progress = Convert.ToInt32( aC.trait_temp.curValue),
                IsClickable =  aC.trait_on_off.curValue.ToString() == "on" ,
                ArcColor = CSS_Color.BackgroundColor,
                SeekBarPadding = Application.GetRealWidth(8),
#else
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(120 + 40),
                Width = Application.GetRealWidth(260 - 40),
                Height = Application.GetRealWidth(260 - 40),
                OpenAngle = 160,
                ThumbImagePath = aC.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
                ThumbImageHeight = Application.GetRealWidth(50),
                ProgressBarColor = aC.trait_on_off.curValue.ToString() == "on" ? CSS_Color.MainColor : CSS_Color.PromptingColor2,
                MinValue = 16,
                MaxValue = 38,
                Progress = Convert.ToInt32( aC.trait_temp.curValue),
                IsClickable = aC.trait_on_off.curValue.ToString() == "on",
                ArcColor = CSS_Color.BackgroundColor,
                SeekBarPadding = Application.GetRealWidth(7),
#endif
            };
            controlView.AddChidren(arcBar);
@@ -157,9 +179,9 @@
                Width = Application.GetRealWidth(71),
                Height = Application.GetRealWidth(60),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 56,
                TextSize = 50,
                IsBold = true,
                Text = "20",
                Text = aC.trait_temp.curValue.ToString(),
                TextAlignment = TextAlignment.Center,
            };
            controlView.AddChidren(btnTemp);
@@ -169,7 +191,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,
@@ -210,23 +232,23 @@
            };
            controlView.AddChidren(btnPlus);
            btnPattern = new Button()
            btnMode = new Button()
            {
                X = Application.GetRealWidth(64),
                Y = Application.GetRealHeight(330),
                Width = Application.GetRealWidth(38),
                Height = Application.GetRealWidth(38),
                UnSelectedImagePath = "FunctionIcon/AC/CoolIcon.png",
                X = Application.GetRealWidth(60),
                Y = Application.GetRealHeight(334),
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(30),
                UnSelectedImagePath = aC.curModeImage,
            };
            controlView.AddChidren(btnPattern);
            controlView.AddChidren(btnMode);
            btnWindSpeed = new Button()
            {
                X = Application.GetRealWidth(225),
                Y = Application.GetRealHeight(330),
                Width = Application.GetRealWidth(38),
                Height = Application.GetRealWidth(38),
                UnSelectedImagePath = "FunctionIcon/AC/WindHighIcon.png",
                X = Application.GetRealWidth(235),
                Y = Application.GetRealHeight(337),
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(30),
                UnSelectedImagePath = aC.curFanImage,
            };
            controlView.AddChidren(btnWindSpeed);
@@ -238,13 +260,252 @@
                Height = Application.GetRealWidth(40),
                UnSelectedImagePath = "Public/PowerClose.png",
                SelectedImagePath = "Public/PowerOpen.png",
                IsSelected = aC.trait_on_off.curValue.ToString() == "on"
            };
            controlView.AddChidren(btnSwitch);
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(function, actionRefresh);
            new TopViewDiv(bodyView,aC.name).LoadTopView_FunctionTop(aC, actionRefresh);
        }
        /// <summary>
        /// 加载修改模式区域
        /// </summary>
        void LoadDiv_ChangeModeView()
        {
            Dialog dialog = new Dialog();
            FrameLayout dialogView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.DialogTransparentColor1,
            };
            dialog.AddChidren(dialogView);
            FrameLayout modeChangeView;
            modeChangeView = new FrameLayout()
            {
                X = Application.GetRealWidth(30),
                Y = Application.GetRealHeight(128),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(287),
                BackgroundImagePath = "FunctionIcon/AC/DivBg1.png",
                Animate = Animate.UpToDown,
                AnimateSpeed = 0.3f
            };
            dialogView.AddChidren(modeChangeView);
            Button btnTitle;
            btnTitle = new Button()
            {
                X = Application.GetRealWidth(8+16),
                Y = Application.GetRealHeight(8),
                Width = Application.GetRealWidth(112),
                Height = Application.GetRealHeight(44),
                TextID = StringId.ChooseMode,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
            };
            modeChangeView.AddChidren(btnTitle);
            Button btnLine = new Button()
            {
                X = btnTitle.X,
                Y = btnTitle.Bottom,
                Width = Application.GetRealWidth(112),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.BackgroundColor,
            };
            modeChangeView.AddChidren(btnLine);
            foreach(var m in aC.trait_mode.value)
            {
                Button btnModeIcon = new Button()
                {
                    X = btnTitle.X,
                    Y = Application.GetRealHeight(44 * (aC.trait_mode.value.IndexOf(m) + 1) + 10 + 8),
                    Width = Application.GetRealWidth(24),
                    Height = Application.GetRealWidth(24),
                    IsSelected = aC.trait_mode.curValue.ToString() == m,
                };
                modeChangeView.AddChidren(btnModeIcon);
                Button btnModeText = new Button()
                {
                    X = Application.GetRealWidth(12) + btnModeIcon.Right,
                    Y = Application.GetRealHeight(44 * (aC.trait_mode.value.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_mode.curValue.ToString() == m,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                modeChangeView.AddChidren(btnModeText);
                switch (m)
                {
                    case "auto":
                        btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/AutoIconGray.png";
                        btnModeIcon.SelectedImagePath = "FunctionIcon/AC/AutoIcon.png";
                        btnModeText.TextID = StringId.Auto;
                        break;
                    case "cool":
                        btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/CoolIconGray.png";
                        btnModeIcon.SelectedImagePath = "FunctionIcon/AC/CoolIcon.png";
                        btnModeText.TextID = StringId.Cool;
                        break;
                    case "heat":
                        btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/HeatingIconGray.png";
                        btnModeIcon.SelectedImagePath = "FunctionIcon/AC/HeatingIcon.png";
                        btnModeText.TextID = StringId.Heat;
                        break;
                    case "dry":
                        btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/DehumidificationIconGray.png";
                        btnModeIcon.SelectedImagePath = "FunctionIcon/AC/DehumidificationIcon.png";
                        btnModeText.TextID = StringId.Dry;
                        break;
                    case "fan":
                        btnModeIcon.UnSelectedImagePath = "FunctionIcon/AC/AirSupplyIconGray.png";
                        btnModeIcon.SelectedImagePath = "FunctionIcon/AC/AirSupplyIcon.png";
                        btnModeText.TextID = StringId.AirSupply;
                        break;
                }
                if(aC.trait_mode.value.IndexOf(m) < aC.trait_mode.value.Count-1)
                {
                    modeChangeView.AddChidren(new Button()
                    {
                        X = btnTitle.X,
                        Y = btnModeText.Bottom ,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS_Color.BackgroundColor,
                    });
                }
                LoadEvent_ChangeMode(dialog, dialogView, btnModeIcon, btnModeText,m);
            }
            dialogView.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
            };
            dialog.Show();
        }
        /// <summary>
        /// 加载修改模式区域
        /// </summary>
        void LoadDiv_ChangeFanView()
        {
            Dialog dialog = new Dialog();
            FrameLayout dialogView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.DialogTransparentColor1,
            };
            dialog.AddChidren(dialogView);
            FrameLayout modeChangeView;
            modeChangeView = new FrameLayout()
            {
                X = Application.GetRealWidth(185),
                Y = Application.GetRealHeight(172),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(243),
                AnimateSpeed = 0.3f,
                BackgroundImagePath = "FunctionIcon/AC/DivBg2.png",
                Animate = Animate.UpToDown,
            };
            dialogView.AddChidren(modeChangeView);
            Button btnTitle;
            btnTitle = new Button()
            {
                X = Application.GetRealWidth(8 + 16),
                Y = Application.GetRealHeight(8),
                Width = Application.GetRealWidth(112),
                Height = Application.GetRealHeight(44),
                TextID = StringId.ChooseFan,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
            };
            modeChangeView.AddChidren(btnTitle);
            Button btnLine = new Button()
            {
                X = btnTitle.X,
                Y = btnTitle.Bottom,
                Width = Application.GetRealWidth(112),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.BackgroundColor,
            };
            modeChangeView.AddChidren(btnLine);
            foreach (var m in aC.trait_fan.value)
            {
                Button btnFanIcon = new Button()
                {
                    X = btnTitle.X,
                    Y = Application.GetRealHeight(44 * (aC.trait_fan.value.IndexOf(m) + 1) + 10 + 8),
                    Width = Application.GetRealWidth(24),
                    Height = Application.GetRealWidth(24),
                    IsSelected = aC.trait_fan.curValue.ToString() == m,
                };
                modeChangeView.AddChidren(btnFanIcon);
                Button btnFanText = new Button()
                {
                    X = Application.GetRealWidth(12) + btnFanIcon.Right,
                    Y = Application.GetRealHeight(44 * (aC.trait_fan.value.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.curValue.ToString() == m,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                modeChangeView.AddChidren(btnFanText);
                switch (m)
                {
                    case "high":
                        btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/WindHighIconGray.png";
                        btnFanIcon.SelectedImagePath = "FunctionIcon/AC/WindHighIcon.png";
                        btnFanText.TextID = StringId.HighWindSpeed;
                        break;
                    case "medium":
                        btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/WindMediumIconGray.png";
                        btnFanIcon.SelectedImagePath = "FunctionIcon/AC/WindMediumIcon.png";
                        btnFanText.TextID = StringId.MiddleWindSpeed;
                        break;
                    case "low":
                        btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/WindLowIconGray.png";
                        btnFanIcon.SelectedImagePath = "FunctionIcon/AC/WindLowIcon.png";
                        btnFanText.TextID = StringId.LowWindSpeed;
                        break;
                    case "auto":
                        btnFanIcon.UnSelectedImagePath = "FunctionIcon/AC/AutoIconGray.png";
                        btnFanIcon.SelectedImagePath = "FunctionIcon/AC/AutoIcon.png";
                        btnFanText.TextID = StringId.Auto;
                        break;
                }
                if (aC.trait_fan.value.IndexOf(m) < aC.trait_fan.value.Count - 1)
                {
                    modeChangeView.AddChidren(new Button()
                    {
                        X = btnTitle.X,
                        Y = btnFanText.Bottom,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS_Color.BackgroundColor,
                    });
                }
                LoadEvent_ChangeFan(dialog, dialogView, btnFanIcon, btnFanText,m);
            }
            dialog.Show();
        }
    }
}
}