mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs
@@ -28,18 +28,27 @@
        /// </summary>
        Button btnTemp;
        Button btnTempUint;
        /// <summary>
        /// 室内湿度显示控件
        /// </summary>
        TextButton btnHumidityValues;
        /// <summary>
        /// 室内温度显示控件
        /// </summary>
        TextButton btnTempValues;
        /// <summary>
        /// 室内温度按钮
        /// </summary>
        Button btnIndoorTemp;
        //Button btnIndoorTemp;
        /// <summary>
        /// 模式按钮
        /// </summary>
        Button btnMode;
        /// <summary>
        /// 扫风按钮
        ///
        /// </summary>
        Button btnSwing;
        Button btnModeText;
        /// <summary>
        /// 风速按钮
        /// </summary>
@@ -93,6 +102,7 @@
            this.RefreshNowDeviceStatuMemory(this.device);
            //刷新界面状态
            this.RefreshFormStatu();
            controlTime = DateTime.Now;
            //读取状态
            new System.Threading.Thread(() =>
            {
@@ -100,7 +110,7 @@
                {
                    if (controlTime == DateTime.MinValue)
                    {
                    }
                    else if (controlTime.AddSeconds(2) < DateTime.Now)
                    {
@@ -118,7 +128,58 @@
        /// </summary>
        private void InitFrameWhiteContent1()
        {
            var btnHumidityIcon = new Button()
            {
                X = Application.GetRealWidth(194),
                Y = Application.GetRealHeight(101),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "FunctionIcon/CAC/HvacCacHumidityIcon.png",
            };
            FrameWhiteCentet1.AddChidren(btnHumidityIcon);
            btnHumidityValues = new TextButton()
            {
                X = Application.GetRealWidth(222),
                Y = Application.GetRealHeight(96),
                Height = Application.GetRealHeight(33),
                Width = Application.GetRealWidth(100),
                TextColor = 0xFF161616,
                TextSize = 24,
                Text = device.GetAttrState(FunctionAttributeKey.RoomHumidity) + "%",
                TextAlignment = TextAlignment.CenterLeft,
            };
            FrameWhiteCentet1.AddChidren(btnHumidityValues);
            Button btnTempIcon = new Button()
            {
                X = Application.GetRealWidth(55),
                Y = Application.GetRealHeight(101),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "FunctionIcon/CAC/HvacCacTempIcon.png",
            };
            FrameWhiteCentet1.AddChidren(btnTempIcon);
            btnTempValues = new TextButton()
            {
                X = Application.GetRealWidth(83),
                Y = Application.GetRealHeight(96),
                Height = Application.GetRealHeight(33),
                Width = Application.GetRealWidth(100),
                TextColor = 0xFF161616,
                TextSize = 24,
                Text = device.GetAttrState(FunctionAttributeKey.RoomTemp) + "°C",
                TextAlignment = TextAlignment.CenterLeft,
            };
            FrameWhiteCentet1.AddChidren(btnTempValues);
            temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."));
            if (temp <= 0)
            {
                temp = 16;
                device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
            }
            arcBar = new DiyArcSeekBar()
            {
                Gravity = Gravity.CenterHorizontal,
@@ -128,12 +189,12 @@
                OfflineProgressBarColor = CSS_Color.PromptingColor2,
                ArcColor = CSS_Color.BackgroundColor,
#if __IOS__
                Y = Application.GetRealHeight(120 + 25),
                Y = Application.GetRealHeight(130 + 25),
                Width = Application.GetRealWidth(260 - 40),
                Height = Application.GetRealWidth(260 - 40),
                SeekBarPadding = Application.GetRealWidth(8),
#else
                Y = Application.GetRealHeight(120 + 40),
                Y = Application.GetRealHeight(130 + 40),
                Width = Application.GetRealWidth(260 - 40),
                Height = Application.GetRealWidth(260 - 40),
                SeekBarPadding = Application.GetRealWidth(7),
@@ -147,18 +208,18 @@
            arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off";
            arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min;
            arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max;
            arcBar.Progress = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."));
            arcBar.Progress =temp;
            btnTemp = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(206),
                Y = Application.GetRealHeight(226),
                Width = Application.GetRealWidth(71),
                Height = Application.GetRealWidth(60),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 50,
                IsBold = true,
                Text = Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")).ToString(),
                Text = Convert.ToDouble(temp).ToString(),
                TextAlignment = TextAlignment.Center,
            };
            FrameWhiteCentet1.AddChidren(btnTemp);
@@ -177,17 +238,17 @@
            };
            FrameWhiteCentet1.AddChidren(btnTempUint);
            btnIndoorTemp = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = btnTemp.Bottom,
                Width = Application.GetRealWidth(120),
                Height = Application.GetRealHeight(20),
                Text = Language.StringByID(StringId.IndoorTemp) + "20°C",
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            FrameWhiteCentet1.AddChidren(btnIndoorTemp);
            //btnIndoorTemp = new Button()
            //{
            //    Gravity = Gravity.CenterHorizontal,
            //    Y = btnTemp.Bottom,
            //    Width = Application.GetRealWidth(120),
            //    Height = Application.GetRealHeight(20),
            //    Text = Language.StringByID(StringId.IndoorTemp) + "20°C/" + Language.StringByID(StringId.Humidity) +"45%",
            //    TextColor = CSS_Color.PromptingColor1,
            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //};
            //FrameWhiteCentet1.AddChidren(btnIndoorTemp);
            btnMinus = new Button()
            {
@@ -215,34 +276,45 @@
                Y = Application.GetRealHeight(334),
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(30),
                UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)),
                UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode),true),
            };
            FrameWhiteCentet1.AddChidren(btnMode);
            btnSwing = new Button()
            btnModeText = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(330),
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealWidth(40),
                UnSelectedImagePath = "FunctionIcon/AC/SweepIconNullOn.png",
                X = Application.GetRealWidth(30),
                Y = btnMode.Bottom + Application.GetRealHeight(4),
                Width = Application.GetRealWidth(90),
                Height = Application.GetRealHeight(20),
                TextAlignment = TextAlignment.Center,
                TextSize = 12,
                TextColor = CSS_Color.TextualColor,
                Text = acFunction.GetModeAttrText(device.GetAttrState(FunctionAttributeKey.Mode))
            };
            if (device.GetAttribute(FunctionAttributeKey.Swing) != null)
            {
                FrameWhiteCentet1.AddChidren(btnSwing);
            }
            FrameWhiteCentet1.AddChidren(btnModeText);
            btnWindSpeed = new Button()
            {
                X = Application.GetRealWidth(235),
                Y = Application.GetRealHeight(337),
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealWidth(30),
                UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)),
                X = Application.GetRealWidth(238),
                Y = Application.GetRealHeight(333),
                Width = Application.GetRealWidth(38),
                Height = Application.GetRealWidth(38),
                UnSelectedImagePath = "FunctionIcon/CAC/DataIcon.png",
            };
            FrameWhiteCentet1.AddChidren(btnWindSpeed);
            Button btnDataText = new Button()
            {
                X = Application.GetRealWidth(212),
                Y = btnWindSpeed.Bottom,
                Width = Application.GetRealWidth(90),
                Height = Application.GetRealHeight(20),
                TextAlignment = TextAlignment.Center,
                TextSize = 12,
                TextColor = CSS_Color.TextualColor,
                TextID = StringId.Data
            };
            FrameWhiteCentet1.AddChidren(btnDataText);
            btnSwitch = new Button()
            {
@@ -259,7 +331,6 @@
            LoadEvent_TempChange();
            LoadEvent_AcStatesChange();
            LoadDiv_IrView();
        }
        /// <summary>
@@ -279,10 +350,10 @@
            modeChangeView = new FrameLayout()
            {
                X = Application.GetRealWidth(30),
                Y = Application.GetRealHeight(128),
                Y = Application.GetRealHeight(128 + 135),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(287),
                BackgroundImagePath = "FunctionIcon/AC/DivBg1.png",
                Height = Application.GetRealHeight(152),
                BackgroundImagePath = "Public/dialogBg2.png",
            };
            dialogView.AddChidren(modeChangeView);
@@ -394,456 +465,6 @@
            dialogView.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
            };
            dialog.Show();
        }
        /// <summary>
        /// 加载修改扫风模式区域
        /// </summary>
        void LoadDiv_ChangeSwingView()
        {
            Dialog dialog = new Dialog();
            FrameLayout dialogView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.DialogTransparentColor1,
            };
            dialog.AddChidren(dialogView);
            FrameLayout modeChangeView;
            modeChangeView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(128),
                Width = Application.GetRealWidth(160),
                Height = Application.GetRealHeight(287),
                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.Swing,
                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 = device.GetAttribute(FunctionAttributeKey.Swing).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 = device.GetAttrState(FunctionAttributeKey.Swing) == 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 = device.GetAttrState(FunctionAttributeKey.Swing) == m,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                modeChangeView.AddChidren(btnModeText);
                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,
                    });
                }
                btnModeIcon.UnSelectedImagePath = acFunction.GetSwingIconPath(m, false);
                btnModeIcon.SelectedImagePath = acFunction.GetSwingIconPath(m);
                btnModeText.Text = acFunction.GetSwingAttrText(m);
                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                {
                    dialog.Close();
                };
                EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
                {
                    //if (!device.online)
                    //{
                    //    new Tip()
                    //    {
                    //        CloseTime = 1,
                    //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
                    //        Direction = AMPopTipDirection.None,
                    //    }.Show(MainPage.BaseView);
                    //}
                    btnModeIcon.IsSelected = btnModeText.IsSelected = true;
                    device.SetAttrState(FunctionAttributeKey.Swing, m);
                    btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(m);
                    Dictionary<string, string> d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.Swing, m);
                    Control.Ins.SendWriteCommand(device, d);
                    dialog.Close();
                };
                btnModeIcon.MouseUpEventHandler = eventHandler1;
                btnModeText.MouseUpEventHandler = eventHandler1;
                dialogView.MouseUpEventHandler = eventHandler;
            }
            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 = device.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 = device.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 = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                modeChangeView.AddChidren(btnFanText);
                btnFanIcon.UnSelectedImagePath = acFunction.GetFanIconPath(m, false);
                btnFanIcon.SelectedImagePath = acFunction.GetFanIconPath(m);
                btnFanText.Text = acFunction.GetFanAttrText(m);
                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,
                    });
                }
                EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) =>
                {
                    dialog.Close();
                };
                EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
                {
                    //if (!device.online)
                    //{
                    //    new Tip()
                    //    {
                    //        CloseTime = 1,
                    //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
                    //        Direction = AMPopTipDirection.None,
                    //    }.Show(MainPage.BaseView);
                    //}
                    btnFanIcon.IsSelected = btnFanText.IsSelected = true;
                    device.SetAttrState(FunctionAttributeKey.FanSpeed, m);
                    btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(m);
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.FanSpeed, m);
                    Control.Ins.SendWriteCommand(device, d);
                    //btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath;
                    dialog.Close();
                };
                btnFanIcon.MouseUpEventHandler = eventHandler1;
                btnFanText.MouseUpEventHandler = eventHandler1;
                dialogView.MouseUpEventHandler = closeDialogEvent;
            }
            dialog.Show();
        }
        /// <summary>
        /// 加载红外遥控器,额外按钮
        /// </summary>
        void LoadDiv_IrView()
        {
            if (device.spk == SPK.AcIr)
            {
                var btnMore = new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(334 + 80),
                    Width = Application.GetRealWidth(35),
                    Height = Application.GetRealWidth(35),
                    UnSelectedImagePath = "FunctionIcon/AC/More.png",
                };
                FrameWhiteCentet1.AddChidren(btnMore);
                btnMore.MouseUpEventHandler = (sender, e) => {
                    LoadDialog_IrMoreView();
                };
            }
        }
        /// <summary>
        /// 加载额外对红外按钮界面
        /// </summary>
        void LoadDialog_IrMoreView()
        {
            Dialog dialog = new Dialog();
            var div = new FrameLayout();
            dialog.AddChidren(div);
            div.MouseUpEventHandler = (sender, e) => {
                dialog.Close();
            };
            var bodyView = new FrameLayout()
            {
                Y = Application.GetRealHeight(427),//667
                Height = Application.GetRealHeight(240),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            div.AddChidren(bodyView);
            var contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(16),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(296 + 200),
            };
            bodyView.AddChidren(contentView);
            var row = new FrameLayout()
            {
                Height = Application.GetRealHeight(60),
                Width = Application.GetRealWidth(296),
                Gravity = Gravity.CenterHorizontal,
            };
            contentView.AddChidren(row);
            int index = 0;
            List<FunctionAttributes> attrList = new List<FunctionAttributes>();
            attrList.AddRange(device.attributes);
            attrList.Add(new FunctionAttributes()
            {
                key = "+",
            });
            foreach (var attr in attrList)
            {
                if (attr.key == FunctionAttributeKey.Mode
                    || attr.key == FunctionAttributeKey.OnOff
                    || attr.key == FunctionAttributeKey.SetTemp
                    || attr.key == FunctionAttributeKey.SetTempStep
                    || attr.key == FunctionAttributeKey.FanSpeed
                    || attr.key == FunctionAttributeKey.FanManual
                    || attr.key == FunctionAttributeKey.FanAuto
                    )
                {
                    continue;
                }
                if (index != 0 && index % 3 == 0)
                {
                    row = new FrameLayout()
                    {
                        Height = Application.GetRealHeight(56),
                        Width = Application.GetRealWidth(296),
                        Gravity = Gravity.CenterHorizontal,
                    };
                    contentView.AddChidren(row);
                }
                if (attr.key == "+")
                {
                    var addView = new FrameLayout()
                    {
                        Gravity = Gravity.CenterVertical,
                        Width = Application.GetRealWidth(88),
                        Height = Application.GetRealHeight(40),
                        Radius = (uint)Application.GetRealHeight(18),
                        BorderColor = CSS_Color.PromptingColor1,
                        BorderWidth = (uint)Application.GetRealWidth(2),
                    };
                    if (index % 3 == 1)
                    {
                        addView.Gravity = Gravity.Center;
                    }
                    else if (index % 3 == 2)
                    {
                        addView.X = Application.GetRealWidth(208);
                    }
                    row.AddChidren(addView);
                    var btnAdd = new Button()
                    {
                        Gravity = Gravity.Center,
                        UnSelectedImagePath = "Public/PlusSignIcon.png",
                        Width = Application.GetRealWidth(32),
                        Height = Application.GetRealWidth(32),
                    };
                    addView.AddChidren(btnAdd);
                    btnAdd.MouseUpEventHandler = (sender, e) =>
                    {
                        dialog.Close();
                        Action action = () => {
                            LoadDialog_IrMoreView();
                        };
                        var addButton = new AcControlPage_AddIrButton(action);
                        MainPage.BasePageView.AddChidren(addButton);
                        addButton.Show(device);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    };
                }
                else
                {
                    var btn = new Button()
                    {
                        Gravity = Gravity.CenterVertical,
                        Width = Application.GetRealWidth(88),
                        Height = Application.GetRealHeight(40),
                        Radius = (uint)Application.GetRealHeight(18),
                        BorderColor = CSS_Color.PromptingColor1,
                        BorderWidth = (uint)Application.GetRealWidth(2),
                        TextAlignment = TextAlignment.Center,
                        TextSize = CSS_FontSize.TextFontSize,
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        SelectedTextColor = CSS_Color.MainBackgroundColor,
                        SelectedBackgroundColor = CSS_Color.MainColor,
                    };
                    if (attr.value.Count > 0)
                    {
                        btn.Text = attr.value[0];
                    }
                    if (index % 3 == 1)
                    {
                        btn.Gravity = Gravity.Center;
                    }
                    else if (index % 3 == 2)
                    {
                        btn.X = Application.GetRealWidth(208);
                    }
                    row.AddChidren(btn);
                    btn.MouseUpEventHandler = (sender, e) =>
                    {
                        //if (!device.online)
                        //{
                        //    new Tip()
                        //    {
                        //        CloseTime = 1,
                        //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
                        //        Direction = AMPopTipDirection.None,
                        //    }.Show(MainPage.BaseView);
                        //}
                        Dictionary<string, string> d = new Dictionary<string, string>();
                        d.Add(attr.key, "");
                        Control.Ins.SendWriteCommand(device, d);
                        new System.Threading.Thread(() =>
                        {
                            System.Threading.Thread.Sleep(2000);
                            Application.RunOnMainThread(() =>
                            {
                                btn.IsSelected = false;
                            });
                        })
                        { IsBackground = true }.Start();
                    };
                }
                index++;
            }
            dialog.Show();
        }
@@ -967,30 +588,48 @@
        /// </summary>
        void LoadEvent_AcStatesChange()
        {
            btnMode.MouseUpEventHandler = (sender, e) =>
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                if (device.trait_on_off.curValue.ToString() == "off")
                {
                    return;
                }
                LoadDiv_ChangeModeView();
            };
            //扫风改变模式
            btnSwing.MouseUpEventHandler = (sender, e) =>
            {
                if (device.trait_on_off.curValue.ToString() == "off")
                var modeValueList = device.GetAttribute(FunctionAttributeKey.Mode).value;
                if (modeValueList.Count == 0)
                {
                    return;
                }
                LoadDiv_ChangeSwingView();
                var curMode = device.GetAttrState(FunctionAttributeKey.Mode);
                var curModeIndex = device.GetAttribute(FunctionAttributeKey.Mode).value.IndexOf(curMode);
                if (++curModeIndex >= modeValueList.Count)
                {
                    curModeIndex = 0;
                }
                var setMode = device.GetAttribute(FunctionAttributeKey.Mode).value[curModeIndex];
                device.SetAttrState(FunctionAttributeKey.Mode, setMode);
                btnModeText.Text = acFunction.GetModeAttrText(setMode);
                btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(setMode);
                Dictionary<string, string> d = new Dictionary<string, string>();
                d.Add(FunctionAttributeKey.Mode, setMode);
                Control.Ins.SendWriteCommand(device, d);
                //LoadDiv_ChangeModeView();
            };
            btnMode.MouseUpEventHandler = eventHandler;
            btnModeText.MouseUpEventHandler = eventHandler;
            btnWindSpeed.MouseUpEventHandler = (sender, e) =>
            {
                if (device.trait_on_off.curValue.ToString() == "off")
                {
                    return;
                }
                LoadDiv_ChangeFanView();
                var page = new CacHistoryChoosePage(device);
                MainPage.BasePageView.AddChidren(page);
                page.InitView();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            btnSwitch.MouseUpEventHandler = (sender, e) =>
@@ -1042,22 +681,22 @@
                }
                else
                {
                    btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "°C";
                    btnMode.SelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
                    btnSwing.SelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing));
                    btnWindSpeed.SelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed));
                    btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode), false);
                    btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing), false);
                    btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed), false);
                    temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")));
                    //btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "°C"
                    //                    + Language.StringByID(StringId.Humidity) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState("room_humidity").Replace(", ", "."))) + "%";
                    btnTempValues.Text = Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", ".")) + "°C";
                    btnHumidityValues.Text = Convert.ToDouble(device.GetAttrState("room_humidity").Replace(", ", ".")) + "%";
                    btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
                    btnModeText.Text = acFunction.GetModeAttrText(device.GetAttrState(FunctionAttributeKey.Mode));
                    temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")));
                    arcBar.Progress = temp;
                    btnTemp.Text = temp.ToString();
                    if (device.trait_on_off.curValue.ToString() == "on")
                    {
                        btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = true;
                        arcBar.IsOffline = false;
                        btnSwitch.IsSelected = true;
                        arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
@@ -1072,7 +711,6 @@
                    }
                    else
                    {
                        btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = false;
                        arcBar.IsOffline = true;
                        btnSwitch.IsSelected = false;
                        arcBar.IsClickable = false;