From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:50:43 +0800
Subject: [PATCH] Revert "1"

---
 HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs |  347 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 305 insertions(+), 42 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
index d189929..345f80f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
+++ b/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,9 +55,18 @@
         /// 鐢垫簮鎸夐挳
         /// </summary>
         Button btnSwitch;
+        /// <summary>
+        /// 淇敼妯″紡淇℃伅鍖哄煙
+        /// </summary>
+        //FrameLayout modeChangeView;
+        /// <summary>
+        /// 淇敼椋庨�熶俊鎭尯鍩�
+        /// </summary>
+        //FrameLayout fanChangeView;
         #endregion
 
         #region 鍖哄煙鍙橀噺
+        AC acTemp = new AC();
         Function function;
         Button btnCollection_Out;
         Button btnFunctionName_Out;
@@ -124,29 +133,41 @@
                 Height = Application.GetMinRealAverage(40),
                 SelectedImagePath = "Collection/CollectionIcon.png",
                 UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
-                IsSelected = function.collection
+                IsSelected = function.collect
             };
             controlView.AddChidren(btnCollection);
+            //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
+            //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare)
+            //{
+            //    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,
+                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,
-                ThumbRadius = Application.GetRealWidth(14),
-                ArcWidthWithDefaultStyle = Application.GetRealWidth(12),
-                MinValue = 16,
-                MaxValue = 38,
-                Progress = 16,
-                ProgressBarUnitSring = "掳C",
-                IsClickable = true,
-                ProgressTextColor = 0x00000000,
+                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 = (int)Convert.ToDouble(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);
 
@@ -157,9 +178,9 @@
                 Width = Application.GetRealWidth(71),
                 Height = Application.GetRealWidth(60),
                 TextColor = CSS_Color.FirstLevelTitleColor,
-                TextSize = 56,
+                TextSize = 50,
                 IsBold = true,
-                Text = "20",
+                Text = Convert.ToDouble(function.GetAttrState(FunctionAttributeKey.SetTemp)).ToString(),
                 TextAlignment = TextAlignment.Center,
             };
             controlView.AddChidren(btnTemp);
@@ -169,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,
@@ -182,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,
@@ -210,41 +231,283 @@
             };
             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 = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)),
             };
-            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 = 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 = function.trait_on_off.curValue.ToString() == "on"
             };
             controlView.AddChidren(btnSwitch);
 
-
             LoadEventList();
-            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(function, 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>
+        /// 鍔犺浇淇敼妯″紡鍖哄煙
+        /// </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",
+            };
+            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);
+
+            var modeList = function.GetAttribute(FunctionAttributeKey.Mode).value;
+            foreach (var m in modeList)
+            {
+                Button btnModeIcon = new Button()
+                {
+                    X = btnTitle.X,
+                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
+                    Width = Application.GetRealWidth(24),
+                    Height = Application.GetRealWidth(24),
+                    IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
+                };
+                modeChangeView.AddChidren(btnModeIcon);
+
+                Button btnModeText = new Button()
+                {
+                    X = Application.GetRealWidth(12) + btnModeIcon.Right,
+                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8),
+                    Height = Application.GetRealHeight(44),
+                    Width = Application.GetRealWidth(90),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.FirstLevelTitleColor,
+                    SelectedTextColor = CSS_Color.MainColor,
+                    IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == 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 (modeList.IndexOf(m) < modeList.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),
+                BackgroundImagePath = "FunctionIcon/AC/DivBg2.png",
+            };
+            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);
+
+            var modeList = function.GetAttribute(FunctionAttributeKey.FanSpeed).value;
+            foreach (var m in modeList)
+            {
+                Button btnFanIcon = new Button()
+                {
+                    X = btnTitle.X,
+                    Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
+                    Width = Application.GetRealWidth(24),
+                    Height = Application.GetRealWidth(24),
+                    IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
+                };
+                modeChangeView.AddChidren(btnFanIcon);
+
+                Button btnFanText = new Button()
+                {
+                    X = Application.GetRealWidth(12) + btnFanIcon.Right,
+                    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 = function.GetAttrState(FunctionAttributeKey.FanSpeed) == 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 (modeList.IndexOf(m) < modeList.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();
+        }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0