From ec9e37b92075752cd96c558a7d8bffbbc4adc07e Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 13 十月 2021 11:35:43 +0800
Subject: [PATCH] 金茂新风湿度控制

---
 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs |  252 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 245 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
index e0a5cfe..283d38c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
@@ -37,6 +37,11 @@
         /// </summary>
         private NormalViewControl btnFilterScreen = null;
         /// <summary>
+        /// 婊ょ綉浣跨敤瓒呮椂鎻愮ず
+        /// </summary>
+        FrameLayout filterScreenTipView;
+
+        /// <summary>
         /// 鑺傝兘/鑸掗�傚浘鏍囨帶浠�
         /// </summary>
         private IconViewControl btnMode1 = null;
@@ -60,6 +65,14 @@
         /// 椋庨�熸枃鏈帶浠�
         /// </summary>
         private NormalViewControl btnFanView = null;
+        /// <summary>
+        /// 婀垮害璁剧疆鍥炬爣鎺т欢
+        /// </summary>
+        private IconViewControl btnSetHumidity = null;
+        /// <summary>
+        /// 婀垮害璁剧疆鏂囨湰鎺т欢
+        /// </summary>
+        private NormalViewControl btnSetHumidityView = null;
         /// <summary>
         /// 寮�鍏冲浘鏍�
         /// </summary>
@@ -186,6 +199,52 @@
             btnFilterScreen.TextColor = CSS_Color.MainColor;
             this.FrameWhiteCentet1.AddChidren(btnFilterScreen);
 
+            #region 婊ょ綉浣跨敤瓒呮椂鎻愰啋
+            filterScreenTipView = new FrameLayout()
+            {
+                Y = btnFilterScreen.Bottom + Application.GetRealWidth(8),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(295),
+                Height = Application.GetRealHeight(28),
+                Radius = (uint)Application.GetRealWidth(4),
+                BackgroundColor = 0xFFffE8E8,
+                Visible = false,
+            };
+            this.FrameWhiteCentet1.AddChidren(filterScreenTipView);
+
+            Button btnFilterScreenUseTip = new Button()
+            {
+                X = Application.GetRealWidth(8),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(20),
+                Height = Application.GetRealWidth(20),
+                UnSelectedImagePath = "FunctionIcon/AirFresh/btnInfoIcon.png"
+            };
+            filterScreenTipView.AddChidren(btnFilterScreenUseTip);
+
+            Button btnFilterScreenUseTipText = new Button()
+            {
+                X = Application.GetRealWidth(32),
+                Width = Application.GetRealWidth(340),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = 0xFFFF4747,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            };
+            if(Language.CurrentLanguage == "Chinese")
+            {
+                btnFilterScreenUseTipText.Text = "杩囨护缃戜娇鐢ㄨ秴鏃�";
+            }
+            else
+            {
+                btnFilterScreenUseTipText.Text = "Filter use timeout";
+            }
+            filterScreenTipView.AddChidren(btnFilterScreenUseTipText);
+
+
+            #endregion
+
+
+            #region 鑺傝兘
             //鑺傝兘/鑸掗�傚浘鏍�
             this.btnMode1 = new IconViewControl(28);
             btnMode1.X = Application.GetRealWidth(42);
@@ -197,17 +256,20 @@
                 this.ShowMode1SelectView();
             };
             //鑺傝兘/鑸掗�傛枃鏈�
-            this.btnMode1View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
+            this.btnMode1View = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
+            btnMode1View.X = Application.GetRealWidth(21);
             btnMode1View.Y = btnMode1.Bottom + Application.GetRealHeight(6);
             btnMode1View.TextAlignment = TextAlignment.Center;
             btnMode1View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
             btnMode1View.TextColor = CSS_Color.TextualColor;
             this.FrameWhiteCentet1.AddChidren(btnMode1View);
+            #endregion
 
+            #region 妯″紡
             //閫氶/鍔犳箍鍥炬爣
             this.btnMode2 = new IconViewControl(28);
             btnMode2.Y = btnMode1.Y;
-            btnMode2.Gravity = Gravity.CenterHorizontal;
+            btnMode2.X = Application.GetRealWidth(114);
             this.FrameWhiteCentet1.AddChidren(btnMode2);
             btnMode2.ButtonClickEvent += (sender, e) =>
             {
@@ -215,17 +277,20 @@
                 this.ShowMode2SelectView();
             };
             //閫氶/鍔犳箍鏂囨湰
-            this.btnMode2View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
+            this.btnMode2View = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
             btnMode2View.X = btnMode1View.Right;
             btnMode2View.Y = btnMode2.Bottom + Application.GetRealHeight(6);
             btnMode2View.TextAlignment = TextAlignment.Center;
             btnMode2View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
             btnMode2View.TextColor = CSS_Color.TextualColor;
             this.FrameWhiteCentet1.AddChidren(btnMode2View);
+            #endregion
 
+            #region 椋庨��
             //椋庨�熷浘鏍�
             this.btnFan = new IconViewControl(28);
-            btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize;
+            //btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize;
+            btnFan.X = Application.GetRealWidth(186);
             btnFan.Y = btnMode1.Y;
             this.FrameWhiteCentet1.AddChidren(btnFan);
             btnFan.ButtonClickEvent += (sender, e) =>
@@ -234,13 +299,38 @@
                 this.ShowFanSelectView();
             };
             //椋庨�熸枃鏈�
-            this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false);
+            this.btnFanView = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
             btnFanView.X = btnMode2View.Right;
             btnFanView.Y = btnFan.Bottom + Application.GetRealHeight(6);
             btnFanView.TextAlignment = TextAlignment.Center;
             btnFanView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
             btnFanView.TextColor = CSS_Color.TextualColor;
             this.FrameWhiteCentet1.AddChidren(btnFanView);
+            #endregion
+
+
+            #region 婀垮害
+            //婀垮害鍥炬爣
+            this.btnSetHumidity = new IconViewControl(28);
+            btnSetHumidity.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnSetHumidity.IconSize;
+            btnSetHumidity.Y = btnMode1.Y;
+            btnSetHumidity.UnSelectedImagePath = "FunctionIcon/AirFresh/HumiIcon.png";
+            this.FrameWhiteCentet1.AddChidren(btnSetHumidity);
+
+            btnSetHumidity.ButtonClickEvent += (sender, e) =>
+            {
+                LoadEditDialog_Humi();
+            };
+            //婀垮害鏂囨湰
+            this.btnSetHumidityView = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false);
+            btnSetHumidityView.X = btnFanView.Right;
+            btnSetHumidityView.Y = btnSetHumidity.Bottom + Application.GetRealHeight(6);
+            btnSetHumidityView.TextAlignment = TextAlignment.Center;
+            btnSetHumidityView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
+            btnSetHumidityView.TextColor = CSS_Color.TextualColor;
+            btnSetHumidityView.Text = "0%";
+            this.FrameWhiteCentet1.AddChidren(btnSetHumidityView);
+            #endregion
 
             //寮�鍏冲浘鏍�
             this.btnSwitch = new IconViewControl(32);
@@ -329,7 +419,7 @@
             //鑿滃崟鎺т欢(妯″紡)
             var menuContr = new DialogTitleMenuControl(2, Language.StringByID(StringId.Mode));
             menuContr.Y = Application.GetRealHeight(277);
-            menuContr.Gravity = Gravity.CenterHorizontal;
+            menuContr.X = Application.GetRealWidth(72);
             menuContr.Width = Application.GetRealWidth(160);
             menuContr.Height = Application.GetRealHeight(154);
             dialogBody.AddChidren(menuContr);
@@ -355,6 +445,132 @@
 
         #endregion
 
+
+        /// <summary>
+        /// 鍔犺浇婀垮害閫夋嫨寮圭獥
+        /// </summary>
+        /// <param name="function"></param>
+        /// <param name="btn"></param>
+        void LoadEditDialog_Humi()
+        {
+            List<string> pickerItems = new List<string>();
+
+            Dialog dialog = new Dialog();
+
+            var pView = new FrameLayout()
+            {
+                BackgroundColor = CSS_Color.DialogTransparentColor1,
+            };
+            dialog.AddChidren(pView);
+
+            var optionBaseView = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(456 - 60),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(260),
+                AnimateSpeed = 0.3f,
+                Animate = Animate.DownToUp,
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+            };
+            pView.AddChidren(optionBaseView);
+
+            var topView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(40),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+            };
+            optionBaseView.AddChidren(topView);
+            topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
+
+            var btnTilteText = new Button()
+            {
+                Width = Application.GetRealWidth(200),
+                Gravity = Gravity.CenterHorizontal,
+                TextAlignment = TextAlignment.Center,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                IsBold = true,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+            };
+            if(Language.CurrentLanguage == "Chinese")
+            {
+                btnTilteText.Text = "婀垮害璁惧畾";
+            }
+            else
+            {
+                btnTilteText.Text = "Humidity setting";
+            }
+            topView.AddChidren(btnTilteText);
+
+            var btnCancel = new Button()
+            {
+                X = Application.GetRealWidth(21),
+                Width = Application.GetRealWidth(100),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.PromptingColor1,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextID = StringId.Cancel,
+            };
+            topView.AddChidren(btnCancel);
+
+            var btnConfrim = new Button()
+            {
+                Width = Application.GetRealWidth(320),
+                TextAlignment = TextAlignment.CenterRight,
+                TextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextID = StringId.Confirm,
+            };
+            topView.AddChidren(btnConfrim);
+
+            UIPickerView uIPickerView = new UIPickerView()
+            {
+                Y = Application.GetRealHeight(40),
+                Height = Application.GetRealHeight(210),
+                Radius = (uint)Application.GetRealWidth(12),
+            };
+            for (int i = 0; i <= 100; i ++)
+            {
+                pickerItems.Add(i.ToString());
+            }
+            uIPickerView.setNPicker(pickerItems, null, null);
+            optionBaseView.AddChidren(uIPickerView);
+            //uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
+
+            string selectItem = pickerItems[0];
+            //if (pickerItems.Contains(trait.value + trait.GetUintString()))
+            //{
+            //    selectItem = trait.value.ToString() + trait.GetUintString();
+            //}
+
+            dialog.Show();
+
+            pView.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+            };
+
+            btnCancel.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+            };
+            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
+                selectItem = pickerItems[int1];
+            };
+            btnConfrim.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+                this.SendOtherComand(this.btnSetHumidity, FunctionAttributeKey.Humidity, selectItem);
+                this.btnSetHumidityView.Text = selectItem + "%";
+                //btn.Text = selectItem;
+                //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
+                //trait.value = selectItem.Replace(trait.GetUintString(), "");
+            };
+
+        }
+
+
         #region 鈻� 鏄剧ず椋庨�熼�夋嫨鐣岄潰___________________
 
         /// <summary>
@@ -375,7 +591,7 @@
 
             //鑿滃崟鎺т欢(椋庨��)
             var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.FanSpeed));
-            menuContr.X = Application.GetRealWidth(209);
+            menuContr.X = Application.GetRealWidth(80+62);
             menuContr.Y = Application.GetRealHeight(231);
             menuContr.Width = Application.GetRealWidth(160);
             menuContr.Height = Application.GetRealHeight(199);
@@ -441,6 +657,12 @@
             this.btnSwitch.IsSelected = this.airFreshData.Open;
             //婊ょ綉鍓╀綑
             this.btnFilterScreen.Text = this.dicText["婊ょ綉鍓╀綑"] + this.airFreshData.Filter_remain + "%";
+
+            if(this.airFreshData.Filter_timeout)
+            {
+                this.filterScreenTipView.Visible = true;
+            }
+
 
             //瀹ゅ唴婀垮害
             if (this.btnHumidity.Text == string.Empty || Convert.ToDecimal(this.btnHumidity.Text) != this.airFreshData.Indoor_humidity)
@@ -516,6 +738,8 @@
             }
             this.btnFan.IsSelected = this.airFreshData.Open;
             this.btnFan.CanClick = this.airFreshData.Open;
+
+            this.btnSetHumidityView.Text = this.airFreshData.Humidity.ToString() + "%";
         }
 
         #endregion
@@ -581,6 +805,8 @@
             dic[FunctionAttributeKey.Energy] = this.airFreshData.Energy;
             //椋庨��
             dic[FunctionAttributeKey.FanSpeed] = this.airFreshData.Fan ;
+            //婀垮害
+            dic[FunctionAttributeKey.Humidity] = this.airFreshData.Humidity.ToString();
             //瀹ゅ唴娓╁害
             dic[FunctionAttributeKey.IndoorTemp] =  this.airFreshData.Indoor_temp.ToString();
             ///瀹ゅ唴婀垮害
@@ -641,6 +867,14 @@
                         this.airFreshData.Filter_remain = Convert.ToInt32(data.state);
                     }
                 }
+                //杩囨护缃戞槸鍚﹁秴鏃惰鍛�
+                else if (data.key == FunctionAttributeKey.FilterTimeout)
+                {
+                    if(data.state != string.Empty)
+                    {
+                        this.airFreshData.Filter_timeout = Convert.ToBoolean(data.state);
+                    }
+                }
             }
         }
 
@@ -685,6 +919,10 @@
             /// 鍓╀綑婊ょ綉(%)
             /// </summary>
             public int Filter_remain = 0;
+            /// <summary>
+            /// 杩囨护缃戞槸鍚﹁秴鏃惰鍛�
+            /// </summary>
+            public bool Filter_timeout = false;
         }
 
         #endregion

--
Gitblit v1.8.0