wei
2021-10-13 ec9e37b92075752cd96c558a7d8bffbbc4adc07e
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