gxc
2019-12-25 944b87b6bcccb095cd73f13f4410fb20faf48f74
ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
@@ -1,6 +1,9 @@
using System;
using Shared.Common;
using ZigBee.Device;
using Shared.Phone.Device.CommonForm;
using Shared.Phone.UserView;
using Shared.Phone.Device.DeviceLogic;
namespace Shared.Phone.Device.AC
{
@@ -11,46 +14,64 @@
        /// The action.
        /// </summary>
        public Action action;
        ///// <summary>
        ///// The top view.
        ///// </summary>
        private CommonForm.TopFrameLayout top;
        /// <summary>
        /// 更多设置
        /// </summary>
        private Button moreBtn;
        /// <summary>
        /// 传过来的设备
        /// </summary>
        private DeviceUI device;
        /// <summary>
        /// 传过来的ac
        /// </summary>
        private ZigBee.Device.AC ac;
        /// <summary>
        /// 传过来的房间
        /// </summary>
        private Shared.Common.Room room;
        /// <summary>
        /// The middle fl.
        /// </summary>
        private FrameLayout midFL;
        /// <summary>
        /// 收藏按钮
        /// </summary>
        private Button collectionBtn;
        /// <summary>
        /// 当前室内温度
        /// 传过来的设备
        /// </summary>
        private DeviceUI device;
        /// <summary>
        /// 传过来的房间
        /// </summary>
        private Shared.Common.Room room;
        /// <summary>
        /// 房间
        /// </summary>
        private Button roomBtn;
        /// <summary>
        /// 房间名
        /// </summary>
        private Button roomName;
        /// <summary>
        /// 网关
        /// </summary>
        private ZbGateway zbGateway = null;
        /// <summary>
        /// 是否发送控制命令成功了
        /// </summary>
        private bool sendedControlCommand = false;
        /// <summary>
        /// bodyFrameLayout
        /// </summary>
        private FrameLayout bodyFrameLayout;
        /// <summary>
        /// 室温
        /// </summary>
        private Button indoorTemperatureBtn;
        /// <summary>
        /// OpenOrUpBtn
        /// </summary>
        public Button OpenOrUpBtn;
        /// <summary>
        /// OpenOrUpBtn
        /// </summary>
        public Button CloseOrDownBtn;
        /// <summary>
        /// StopBtn
        /// </summary>
        public Button StopBtn;
        /// <summary>
        /// 当前模式
        /// </summary>
        private Button currentModeBtn;
        /// <summary>
        /// 当前温度
        /// </summary>
        private Button currentTemperatureBtn;
        /// <summary>
        /// 添加温度
        /// </summary>
@@ -72,6 +93,10 @@
        /// </summary>
        private Button fanModeBtn;
        /// <summary>
        /// 扫风模式
        /// </summary>
        private Button FanSwingModeBtn;
        /// <summary>
        /// 风速选择视图
        /// </summary>
        private Dialog fanModeDialog;
@@ -80,10 +105,26 @@
        /// </summary>
        private Dialog acModeDialog;
        /// <summary>
        /// 传过来的ac
        /// </summary>
        private ZigBee.Device.AC ac;
        /// <summary>
        /// mArcScaleSeekBar
        /// </summary>
        private ArcScaleSeekBar mArcScaleSeekBar = new ArcScaleSeekBar { };
        /// <summary>
        /// 清洁状态
        /// </summary>
        private LeftIconButtonRow cleanStatu;
        /// <summary>
        /// IsDrawerLockMode
        /// </summary>
        public bool IsDrawerLockMode;
        #endregion
        #region ◆ 接口__________________________
        #region ◆ 接口___________________________
        /// <summary>
        /// 处理变化事件 --将弃用 改用DeviceInfoChange()
        /// </summary>
@@ -92,22 +133,6 @@
        public void Changed(CommonDevice common)
        {
        }
        /// <summary>
        /// Changeds the IL ogic status.
        /// </summary>
        /// <param name="logic">Logic.</param>
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
            //throw new NotImplementedException();
        }
        /// <summary>
        /// Changeds the IS cene status.
        /// </summary>
        /// <param name="scene">Scene.</param>
        public void ChangedISceneStatus(Scene scene)
        {
            //throw new NotImplementedException();
        }
        /// <summary>
        /// 设备状态更新接口
@@ -128,114 +153,138 @@
                    try
                    {
                        var deviceUI = device;
                        //设备为空
                        if (deviceUI.CommonDevice == null)
                        {
                            return;
                        }
                        //是否为当前设备
                        if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
                        {
                            return;
                        }
                        if (deviceUI.CommonDevice.Type == DeviceType.Thermostat)
                        if (common.DeviceStatusReport.CluterID == 513)
                        {
                            //Thermostat功能
                            if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 513)
                            var attriButeList = common.DeviceStatusReport.AttriBute;
                            if (attriButeList == null || attriButeList.Count == 0)
                            {
                                var attriButeList = (common as ZigBee.Device.AC).DeviceStatusReport.AttriBute;
                                if (attriButeList == null || attriButeList.Count == 0)
                                {
                                    return;
                                }
                                ac.DeviceStatusReport = (common as ZigBee.Device.AC).DeviceStatusReport;
                                switch (attriButeList[0].AttributeId)
                                return;
                            }
                            deviceUI.CommonDevice.DeviceStatusReport = common.DeviceStatusReport;
                            foreach(var attList in attriButeList)
                            {
                                var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High && attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
                                switch (attList.AttributeId)
                                {
                                    case 0:
                                        //此属性表明室内当前的温度 * 100,实际温度为“LocalTemperature / 100”,单位:℃
                                        ac.currentLocalTemperature = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
                                        ac.currentLocalTemperature = curTemp;
                                        ac.LastDateTime = DateTime.Now;
                                        indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.IndoorTemperature)} {ac.currentLocalTemperature} ℃";
                                        indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} ℃";
                                        //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} ℃";
                                        break;
                                    case 17:
                                        //此属性表明此设备当前的制冷温度,实际温度为“CoolingSetpoint / 100”,单位:℃。
                                        ac.currentCoolingSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
                                        ac.currentCoolingSetpoint = curTemp;
                                        if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
                                        {
                                            mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
                                        }
                                        ac.LastDateTime = DateTime.Now;
                                        break;
                                    case 18:
                                        //此属性表明此设备当前的制热温度,实际温度为“HeatingSetpoint / 100”,单位:℃。
                                        ac.currentHeatingSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
                                        ac.currentHeatingSetpoint = curTemp;
                                        if (ac.currentSystemMode == 4)
                                        {
                                            mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
                                        }
                                        ac.LastDateTime = DateTime.Now;
                                        break;
                                    case 4096:
                                        //此属性表明此设备当前的自动温度,实际温度为“AutoSetpoint / 100”,单位:℃。
                                        ac.currentAutoSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default;
                                        ac.currentAutoSetpoint = curTemp;
                                        if (ac.currentSystemMode == 1)
                                        {
                                            mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
                                        }
                                        ac.LastDateTime = DateTime.Now;
                                        break;
                                    case 28:
                                        //此属性描述恒温设备正处于哪种模式
                                        //Off = 0  Auto = 1 Cool = 3 Heat = 4 FanOnly = 7  Dry = 8
                                        ac.currentSystemMode = attriButeList[0].AttriButeData;
                                        ac.currentSystemMode = attList.AttriButeData;
                                        ac.LastDateTime = DateTime.Now;
                                        if (ac.currentSystemMode == 0)
                                        {
                                            switchBtn.IsSelected = false;
                                            modeBtn.IsSelected = false;
                                            modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
                                            modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
                                            currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
                                            fanModeBtn.IsSelected = false;
                                            FanSwingModeBtn.IsSelected = false;
                                            mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
                                        }
                                        else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8)
                                        {
                                            switchBtn.IsSelected = true;
                                            modeBtn.IsSelected = true;
                                            modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
                                            modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
                                            currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
                                            currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} ℃";
                                            fanModeBtn.IsSelected = true;
                                            FanSwingModeBtn.IsSelected = true;
                                            mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor);
                                        }
                                        modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
                                        modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
                                        currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
                                        mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
                                        mArcScaleSeekBar.IsClickable = ACControlBase.IsOpen(ac);
                                        break;
                                    case 4097:
                                        //过虑网清洗标志:42
                                        ac.CleanStatu = attList.AttriButeData == 42;
                                        cleanStatu.Visible = ac.CleanStatu;
                                        break;
                                    case 4099:
                                        var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
                                        var modeStr = value.Substring(value.Length - 5, 5);
                                        for (int j = 0; j < modeStr.Length; j++)
                                        {
                                            ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0;
                                        }
                                        break;
                                }
                            }
                        }
                        //Fan Control功能
                        if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 514)
                        if (common.DeviceStatusReport.CluterID == 514)
                        {
                            var attriButeList = (common as ZigBee.Device.AC).DeviceStatusReport.AttriBute;
                            if (attriButeList == null || attriButeList.Count == 0)
                            var attriButeList = common.DeviceStatusReport.AttriBute;
                            ac.DeviceStatusReport = common.DeviceStatusReport;
                            foreach(var attList in attriButeList)
                            {
                                return;
                                switch (attList.AttributeId)
                                {
                                    case 0:
                                        //风扇当前的工作模式 1=Low 2=Medium 3=High
                                        ac.currentFanMode = attList.AttriButeData;
                                        ac.LastDateTime = DateTime.Now;
                                        fanModeBtn.IsSelected = true;
                                        fanModeBtn.SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode);
                                        fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode);
                                        break;
                                    case 4096:
                                        //风扇当前的扫风模式
                                        ac.currentFanSwingMode = attList.AttriButeData;
                                        ac.LastDateTime = DateTime.Now;
                                        FanSwingModeBtn.IsSelected = true;
                                        FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode);
                                        FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode);
                                        break;
                                }
                            }
                            ac.DeviceStatusReport = (common as ZigBee.Device.AC).DeviceStatusReport;
                            switch (attriButeList[0].AttributeId)
                            {
                                case 0:
                                    //风扇当前的工作模式 1=Low 2=Medium 3=High
                                    ac.currentFanMode = attriButeList[0].AttriButeData;
                                    ac.LastDateTime = DateTime.Now;
                                    fanModeBtn.IsSelected = true;
                                    fanModeBtn.SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode);
                                    fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode);
                                    break;
                            }
                            //***新改***设备状态上报中,当CluterID=3,证明设备在线,直接标记
                            //else if ((common as ToggleLight).DeviceStatusReport.CluterID == 3)
                            //{
                            //var light = deviceUI.CommonDevice as ToggleLight;
                            //light.IsOnline = 1;
                            //deviceIMG.IsSelected = light.IsOnline == 1;
                            //light.LastDateTime = DateTime.Now;
                            //}
                        }
                        //***新改 * **设备状态上报中,当CluterID = 3,证明设备在线,直接标记
                        else if (common.DeviceStatusReport.CluterID == 3)
                        {
                            ac.IsOnline = 1;
                            switchBtn.IsSelected = true;
                            ac.LastDateTime = DateTime.Now;
                        }
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine($"Error:{ex.Message}");
@@ -261,8 +310,7 @@
                        }
                        if (deviceUI.CommonDevice.Type == DeviceType.Thermostat)
                        {
                            ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                            ac.IsOnline = (common as DimmableLight).IsOnline;
                            ac.IsOnline = common.IsOnline;
                            ac.LastDateTime = DateTime.Now;
                        }
                    }
@@ -273,69 +321,87 @@
                });
            }
        }
        #endregion
        #region ◆ 重写移除_______________________
        /// <summary>
        /// Removes from parent.
        /// Changeds the IL ogic status.
        /// </summary>
        public override void RemoveFromParent()
        /// <param name="logic">Logic.</param>
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
            ZbGateway.StatusList.Remove(this);
            base.RemoveFromParent();
            //throw new NotImplementedException();
        }
        /// <summary>
        /// Changeds the IS cene status.
        /// </summary>
        /// <param name="scene">Scene.</param>
        public void ChangedISceneStatus(Scene scene)
        {
            //throw new NotImplementedException();
        }
        #endregion
        #region ◆ 构造方法_______________________
        #region ◆ 构造方法________________________
        /// <summary>
        /// 构造方法
        /// </summary>
        public ACControl()
        {
            BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
            ZigBee.Device.ZbGateway.StatusList.Add(this);
            HomePage.Instance.ScrollEnabled = false;
        }
        #endregion
        #region ◆ 初始化________________________
        #region ◆ 重写移除方法____________________
        /// <summary>
        /// 初始化
        /// Removes from parent.
        /// </summary>
        /// <param name="device">Device.</param>
        /// <param name="room">Room.</param>
        private void InitAC(DeviceUI device, Common.Room room)
        public override void RemoveFromParent()
        {
            ZbGateway.StatusList.Add(this);
            this.device = device;
            ZigBee.Device.ZbGateway.StatusList.Remove(this);
            //action();
            //action = null;
            RemoveUpdateControlDeviceStatuAction();
            HomePage.Instance.ScrollEnabled = true;
            if (IsDrawerLockMode)
            {
                CommonPage.Instance.IsDrawerLockMode = false;
            }
            base.RemoveFromParent();
        }
        #endregion
        #region ◆ 显示界面________________________
        /// <summary>
        /// 显示界面
        /// </summary>
        /// <param name="dev">Device.</param>
        /// <param name="room">Room.</param>
        public void Show(DeviceUI dev, Shared.Common.Room room)
        {
            device = dev;
            zbGateway = this.device.CommonDevice.Gateway;
            this.room = room;
            this.ac = device.CommonDevice as ZigBee.Device.AC;
            AddTop();
            //添加topview
            AddTopView();
            //添加midview
            AddMidview();
            //绑定事件
            BindEvent();
            //收藏
            InitCollection();
            AddBodyView(device);
            if (ac.Gateway == null)
            {
                return;
            }
            if (ac.Gateway.IsVirtual)
            {
                //发送读取状态命令
                UserView.UserHomeView.ReadStatus(ac, () =>
                {
                    ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
                    ac.ReadLocalTemperature();
                    ac.ReadCoolingSetpoint();
                    ac.ReadHeatingSetpoint();
                    ac.ReadAutoSetpoint();
                    ac.ReadFanMode();
                    ac.ReadSystemMode();
                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice);
                });
            }
            else
@@ -343,24 +409,12 @@
                //防止短时间内多次读取设备状态
                if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                {
                    ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
                    ac.ReadLocalTemperature();
                    ac.ReadCoolingSetpoint();
                    ac.ReadHeatingSetpoint();
                    ac.ReadAutoSetpoint();
                    ac.ReadFanMode();
                    ac.ReadSystemMode();
                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice);
                }
            }
        }
        /// <summary>
        /// Inits the collection.
        /// </summary>
        private void InitCollection()
        {
            var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
            if (dev == null)
            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
            if (de == null)
            {
                collectionBtn.IsSelected = false;
            }
@@ -368,32 +422,20 @@
            {
                collectionBtn.IsSelected = true;
            }
        }
        #endregion
        #region ◆ 显示界面_______________________
        /// <summary>
        /// 显示界面
        /// </summary>
        /// <param name="device">Device.</param>
        /// <param name="room">Room.</param>
        public void Show(DeviceUI device, Shared.Common.Room room)
        {
            InitAC(device, room);
            BindEvent();
        }
        #endregion
        #region ◆ topview_______________________
        #region ◆ Add____________________________
        /// <summary>
        /// Adds the top view.
        /// AddTop
        /// </summary>
        private void AddTopView()
        public void AddTop()
        {
            top = new CommonForm.TopFrameLayout();
            var top = new TopFrameLayout();
            AddChidren(top);
            top.InitTopview();
            top.backButton.MouseUpEventHandler += (sender, e) =>
@@ -401,255 +443,286 @@
                RemoveFromParent();
            };
            AddMoreview();
        }
        /// <summary>
        /// Adds the moreview.
        /// </summary>
        private void AddMoreview()
        {
            moreBtn = new CommonForm.SelectedStatuButton()
            var moreBtn = new Button
            {
                X = Application.GetRealWidth(CommonPage.AppRealWidth - 150),
                Width = Application.GetMinReal(110),
                Height = Application.GetMinReal(110),
                X = Application.GetRealWidth(953),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "Item/More.png",
                SelectedImagePath = "Item/MoreSelected.png",
                UnSelectedImagePath = "Item/More.png"
            };
            top.topView.AddChidren(moreBtn);
        }
            moreBtn.MouseUpEventHandler += More;
        }
        /// <summary>
        /// 更多设置
        /// AddBodyView
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        private void MoreEvent(object sender, MouseEventArgs e)
        public void AddBodyView(DeviceUI device)
        {
            var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
            UserView.HomePage.Instance.AddChidren(detailInfo);
            UserView.HomePage.Instance.PageIndex += 1;
            detailInfo.Show(device, room);
            detailInfo.action = () =>
            bodyFrameLayout = new FrameLayout()
            {
                Show(device, room);
                Y = Application.GetRealHeight(184),
                Height = Application.GetRealHeight(1737),
                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
            };
        }
            AddChidren(bodyFrameLayout);
        #endregion
        #region ◆ midview_______________________
        /// <summary>
        /// Adds the midview.
        /// </summary>
        private void AddMidview()
        {
            midFL = new FrameLayout()
            {
                Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
                Y = top.Bottom,
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
            };
            AddChidren(midFL);
            AddItemview();
        }
        #endregion
        #region ◆ itemview_______________________
        /// <summary>
        /// Adds the itemview.
        /// </summary>
        private void AddItemview()
        {
            var itemView = new FrameLayout()
            {
                Y=Application.GetRealHeight(115),
                Y = Application.GetRealHeight(115),
                Width = Application.GetRealWidth(965),
                Height = Application.GetRealHeight(1316),
                Radius = CommonPage.BigFormRadius,
                Height = Application.GetRealHeight(1457),
                Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius),
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
            };
            midFL.AddChidren(itemView);
            var deviceView = new FrameLayout()
            {
                X = 2,
                Y = 2,
                Width = itemView.Width - 4,
                Height = itemView.Height - Application.GetRealHeight(138),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
                Tag = device
            };
            itemView.AddChidren(deviceView);
            bodyFrameLayout.AddChidren(itemView);
            cleanStatu = new LeftIconButtonRow(400, 80, 0, 20);
            itemView.AddChidren(cleanStatu);
            cleanStatu.Init("AC/AC_TIP.png", "AC/AC_TIP.png", Language.StringByID(R.MyInternationalizationString.NeedCleanAC), false);
            cleanStatu.Visible = false;
            collectionBtn = new Button()
            {
                X = deviceView.Width - Application.GetRealWidth(130),
                Y = Application.GetRealHeight(20),
                Width = Application.GetMinReal(110),
                Height = Application.GetMinReal(110),
                X = Application.GetRealWidth(850),
                Y = Application.GetRealHeight(46),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                UnSelectedImagePath = "Item/Collection.png",
                SelectedImagePath = "Item/CollectionSelected.png"
            };
            deviceView.AddChidren(collectionBtn);
            itemView.AddChidren(collectionBtn);
            var deviceName = new Button()
            var deviceNameBtn = new Button()
            {
                Y = Application.GetRealHeight(50),
                Height = Application.GetRealHeight(80),
                Y = Application.GetRealHeight(184),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(60),
                Gravity = Gravity.CenterHorizontal,
                Text=device.CommonDevice.DeviceEpointName,
                TextSize=15,
                TextColor=ZigbeeColor.Current.GXCTextBlackColor
                Text = device.CommonDevice.DeviceEpointName,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextSize = 15
            };
            deviceView.AddChidren(deviceName);
            itemView.AddChidren(deviceNameBtn);
            indoorTemperatureBtn = new Button()
            indoorTemperatureBtn = new Button
            {
                Y = deviceName.Bottom,
                Height = Application.GetRealHeight(80),
                Width = Application.GetRealWidth(300),
                Y = Application.GetRealHeight(256),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(60),
                Gravity = Gravity.CenterHorizontal,
                Text = $"{Language.StringByID(R.MyInternationalizationString.IndoorTemperature)} {ac.currentLocalTemperature}°C" ,
                TextSize = 12,
                TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor
                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
                Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} ℃"
            };
            deviceView.AddChidren(indoorTemperatureBtn);
            itemView.AddChidren(indoorTemperatureBtn);
            var controlBG = new FrameLayout()
            mArcScaleSeekBar = new ArcScaleSeekBar
            {
                Y = Application.GetRealHeight(323),
                Height = Application.GetMinRealAverage(547),
                Width = Application.GetMinRealAverage(671),
                Y = Application.GetRealHeight(412),
                Width = Application.GetRealWidth(671),
                Height = Application.GetRealHeight(671),
                Gravity = Gravity.CenterHorizontal,
                BackgroundImagePath = "AC/Group.png"
                MinValue = ACControlBase.Temperature_Low,
                MaxValue = ACControlBase.Temperature_High,
                Progress = ACControlBase.GetCurrentModeTemperature(ac),
                IsClickable = ACControlBase.IsOpen(ac)
            };
            deviceView.AddChidren(controlBG);
            var controlBG2 = new Button()
            itemView.AddChidren(mArcScaleSeekBar);
            if(ACControlBase.IsOpen(ac))
            {
                Y=Application.GetRealHeight(783),
                Height=Application.GetMinRealAverage(121),
                Width=Application.GetMinRealAverage(351),
                UnSelectedImagePath="AC/Path.png",
                Gravity=Gravity.CenterHorizontal
                mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor);
            }
            else
            {
                mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
            }
            mArcScaleSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
            {
                if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
                {
                    ac.currentCoolingSetpoint = e;
                    ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100);
                }
                else if (ac.currentSystemMode == 4)
                {
                    ac.currentHeatingSetpoint = e;
                    ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100);
                }
                else if (ac.currentSystemMode == 1)
                {
                    ac.currentAutoSetpoint = e;
                    ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100);
                }
            };
            deviceView.AddChidren(controlBG2);
            //当前模式
            currentModeBtn = new Button()
            {
                Y = Application.GetRealHeight(187),
                Y = Application.GetRealHeight(565),
                Height = Application.GetRealHeight(80),
                Width = Application.GetRealWidth(200),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                Gravity=Gravity.CenterHorizontal,
                Text=ACControlBase.GetModeNameByModeId(ac.currentSystemMode)
                Gravity = Gravity.CenterHorizontal,
                Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode)
            };
            controlBG.AddChidren(currentModeBtn);
            //降低温度
            itemView.AddChidren(currentModeBtn);
            reduceTemperatureBtn = new Button()
            {
                X = Application.GetRealWidth(112),
                Y = Application.GetRealHeight(268),
                X = Application.GetRealWidth(268),
                Y = Application.GetRealHeight(650),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = "AC/Reduce.png"
            };
            controlBG.AddChidren(reduceTemperatureBtn);
            itemView.AddChidren(reduceTemperatureBtn);
            //温度
            currentTemperatureBtn = new Button()
            {
                //X = Application.GetRealWidth(239),
                Y = Application.GetRealHeight(248),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(100),
                TextColor=ZigbeeColor.Current.GXCTextBlackColor,
                TextSize=15,
                Text=$"{ACControlBase.GetCurrentModeTemperature(ac)} °C",
                Gravity=Gravity.CenterHorizontal
            };
            controlBG.AddChidren(currentTemperatureBtn);
            //添加温度
            addTemperatureBtn = new Button()
            {
                X = Application.GetRealWidth(472),
                Y = Application.GetRealHeight(268),
                X = Application.GetRealWidth(610),
                Y = Application.GetRealHeight(650),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = "AC/Add.png"
            };
            controlBG.AddChidren(addTemperatureBtn);
            itemView.AddChidren(addTemperatureBtn);
            //模式
            FanSwingModeBtn = new Button()
            {
                X = Application.GetRealWidth(156),
                Y = Application.GetRealHeight(1086),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode),
                SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode),
                IsSelected = ACControlBase.IsOpen(ac)
            };
            itemView.AddChidren(FanSwingModeBtn);
            modeBtn = new Button()
            {
                X = Application.GetRealWidth(207),
                Y = Application.GetRealHeight(996),
                X = Application.GetRealWidth(346),
                Y = Application.GetRealHeight(1086),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode),
                SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode),
                IsSelected = ACControlBase.IsOpen(ac)
            };
            deviceView.AddChidren(modeBtn);
            itemView.AddChidren(modeBtn);
            //开关
            switchBtn = new Button()
            {
                X = Application.GetRealWidth(446),
                Y = Application.GetRealHeight(996),
                X = Application.GetRealWidth(536),
                Y = Application.GetRealHeight(1086),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = "AC/OpenOrClose.png",
                SelectedImagePath = "AC/OpenOrCloseSelected.png",
                IsSelected = ACControlBase.IsOpen(ac)
            };
            deviceView.AddChidren(switchBtn);
            itemView.AddChidren(switchBtn);
            //风速
            fanModeBtn = new Button()
            {
                X = Application.GetRealWidth(667),
                Y = Application.GetRealHeight(996),
                X = Application.GetRealWidth(729),
                Y = Application.GetRealHeight(1086),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode),
                SelectedImagePath = ACControlBase.GetFanModeSelectedImagePathByFanModeId(ac.currentFanMode),
                IsSelected = ACControlBase.IsOpen(ac)
            };
            deviceView.AddChidren(fanModeBtn);
            itemView.AddChidren(fanModeBtn);
            var roomBtn = new Button()
            var roomBG = new Button
            {
                X = Application.GetRealWidth(50),
                Y = Application.GetRealHeight(25) + deviceView.Bottom,
                Y = Application.GetRealHeight(1322 - 50),
                Height = Application.GetRealHeight(138 + 50),
                BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor,
                Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius)
            };
            itemView.AddChidren(roomBG);
            var roomBG2 = new Button
            {
                Y = Application.GetRealHeight(1322 - 50),
                Height = Application.GetRealHeight(50),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
            };
            itemView.AddChidren(roomBG2);
            roomBtn = new Button()
            {
                X = Application.GetRealWidth(CommonFormResouce.X_Left),
                Y = Application.GetRealHeight(1351),
                Width = Application.GetMinReal(80),
                Height = Application.GetMinReal(80),
                UnSelectedImagePath = "Item/Room.png",
                SelectedImagePath = "Item/RoomSelected.png"
                UnSelectedImagePath = "Item/Room.png"
            };
            itemView.AddChidren(roomBtn);
            var roomName = new Button()
            roomName = new Button()
            {
                X = roomBtn.Right + Application.GetRealWidth(20),
                Y = roomBtn.Y,
                X = Application.GetRealWidth(150),
                Y = Application.GetRealHeight(1368),
                Width = Application.GetRealWidth(400),
                Height = Application.GetRealHeight(80),
                Height = Application.GetRealHeight(50),
                Text = room.Name,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor
                TextColor = ZigbeeColor.Current.GXCTextWhiteColor
            };
            itemView.AddChidren(roomName);
        }
        #endregion
        #region ◆ 绑定事件________________________
        /// <summary>
        /// 绑定按钮的事件
        /// </summary>
        private void BindEvent()
        {
            switchBtn.MouseUpEventHandler += Switch_MouseUpEvent;
            collectionBtn.MouseUpEventHandler += Collection;
            fanModeBtn.MouseUpEventHandler += ShowChangeFan_MouseUpEvent;
            modeBtn.MouseUpEventHandler += ShowChangeMode_MouseUpEvent;
            FanSwingModeBtn.MouseUpEventHandler += ShowChangeFanSwing_MouseUpEvent;
            reduceTemperatureBtn.MouseUpEventHandler += Reduce_MouseUpEvent;
            addTemperatureBtn.MouseUpEventHandler += Add_MouseUpEvent;
        }
        #endregion
        #region ◆ 开关__________________________
        /// <summary>
        /// 开关
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void Switch_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
        {
            switchBtn.IsSelected = !switchBtn.IsSelected;
            mArcScaleSeekBar.IsClickable = switchBtn.IsSelected;
            if (switchBtn.IsSelected == true)
            {
                ac.Open();
                modeBtn.IsSelected = true;
                fanModeBtn.IsSelected = true;
                FanSwingModeBtn.IsSelected = true;
                mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor);
            }
            else
            {
                ac.Close();
                modeBtn.IsSelected = false;
                fanModeBtn.IsSelected = false;
                FanSwingModeBtn.IsSelected = false;
                mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
            }
        }
        #endregion
@@ -678,8 +751,8 @@
            var changeFanModeBG = new Button()
            {
                X = Application.GetRealWidth(553),
                Y = Application.GetRealHeight(655),
                X = Application.GetRealWidth(600),
                Y = Application.GetRealHeight(750),
                Height = Application.GetRealHeight(625),
                Width = Application.GetRealWidth(fanItem_Width),
                UnSelectedImagePath = "AC/SelectedFanModeBG.png"
@@ -688,8 +761,8 @@
            var changeFanModeFL = new FrameLayout()
            {
                X = Application.GetRealWidth(553),
                Y = Application.GetRealHeight(655),
                X = Application.GetRealWidth(600),
                Y = Application.GetRealHeight(750),
                Height = Application.GetRealHeight(600),
                Width = Application.GetRealWidth(fanItem_Width),
                Radius = CommonPage.BigFormRadius,
@@ -757,7 +830,7 @@
                {
                    fan_Middle.SetSelectedStatu();
                }
                else if (ac.currentFanMode == 3)
                else
                {
                    fan_Height.SetSelectedStatu();
                }
@@ -769,10 +842,10 @@
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void ChangeFan_MouseUpEvent(object sender,MouseEventArgs mouseEventArgs)
        private void ChangeFan_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
        {
            var tag = (sender as Button).Tag.ToString();
            ZigBee.Device.AC.FanMode mode= ZigBee.Device.AC.FanMode.Low;
            ZigBee.Device.AC.FanMode mode = ZigBee.Device.AC.FanMode.Low;
            if (tag == "Low")
            {
                mode = ZigBee.Device.AC.FanMode.Low;
@@ -806,7 +879,7 @@
            fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanMode(fanMode);
            ac.currentFanMode = (int)(fanMode);
            (device.CommonDevice as ZigBee.Device.AC).SetFanModeAsync(fanMode);
            ac.SetFanModeAsync(fanMode);
        }
        #endregion
@@ -834,21 +907,21 @@
            var changeModeBG = new Button()
            {
                X = Application.GetRealWidth(80),
                Y = Application.GetRealHeight(360),
                X = Application.GetRealWidth(230),
                Y = Application.GetRealHeight(450),
                Height = Application.GetRealHeight(933),
                Width = Application.GetRealWidth(modeItem_Width),
                UnSelectedImagePath = "AC/SelectedModeBG.png"
            };
            closeBGview.AddChidren(changeModeBG);
            var changeModeFL = new FrameLayout()
            var changeModeFL = new VerticalScrolViewLayout()
            {
                X = Application.GetRealWidth(80),
                Y = Application.GetRealHeight(360),
                X = Application.GetRealWidth(230),
                Y = Application.GetRealHeight(450),
                Height = Application.GetRealHeight(900),
                Width = Application.GetRealWidth(modeItem_Width),
                Radius = CommonPage.BigFormRadius,
                Radius = CommonFormResouce.BigFormRadius,
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
                //BackgroundIagePath="AC/SelectedModeBG.png"
            };
@@ -860,7 +933,7 @@
                Width = Application.GetRealWidth(modeItem_Width - modeItem_X),
                Height = Application.GetRealHeight(modeItem_Height),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextID = R.MyInternationalizationString.SelectFanMode,
                TextID = R.MyInternationalizationString.SelectMode,
                TextAlignment = TextAlignment.CenterLeft
            };
            changeModeFL.AddChidren(changeModeBtn);
@@ -872,7 +945,10 @@
                Height = Application.GetRealHeight(modeItem_Height),
                Tag = ZigBee.Device.AC.AcMode.Auto
            };
            changeModeFL.AddChidren(mode_Auto);
            if (ac.listSupportMode[4] == 1)
            {
                changeModeFL.AddChidren(mode_Auto);
            }
            mode_Auto.Init("AC/Mode_Auto.png", "AC/Mode_AutoSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Auto));
            var mode_Cool = new CommonForm.ACLeftIconButtonRowLayout()
@@ -882,7 +958,10 @@
                Height = Application.GetRealHeight(modeItem_Height),
                Tag = ZigBee.Device.AC.AcMode.Cool
            };
            changeModeFL.AddChidren(mode_Cool);
            if (ac.listSupportMode[0] == 1)
            {
                changeModeFL.AddChidren(mode_Cool);
            }
            mode_Cool.Init("AC/Mode_Cool.png", "AC/Mode_CoolSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Cool));
            var mode_Heat = new CommonForm.ACLeftIconButtonRowLayout()
@@ -892,7 +971,10 @@
                Height = Application.GetRealHeight(modeItem_Height),
                Tag = ZigBee.Device.AC.AcMode.Heat
            };
            changeModeFL.AddChidren(mode_Heat);
            if (ac.listSupportMode[1] == 1)
            {
                changeModeFL.AddChidren(mode_Heat);
            }
            mode_Heat.Init("AC/Mode_Heat.png", "AC/Mode_HeatSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Heat));
            var mode_Dry = new CommonForm.ACLeftIconButtonRowLayout()
@@ -902,7 +984,10 @@
                Height = Application.GetRealHeight(modeItem_Height),
                Tag = ZigBee.Device.AC.AcMode.Dry
            };
            changeModeFL.AddChidren(mode_Dry);
            if (ac.listSupportMode[3] == 1)
            {
                changeModeFL.AddChidren(mode_Dry);
            }
            mode_Dry.Init("AC/Mode_Dry.png", "AC/Mode_DrySelected.png", Language.StringByID(R.MyInternationalizationString.Mode_Dry));
            var mode_Fan = new CommonForm.ACLeftIconButtonRowLayout()
@@ -912,8 +997,12 @@
                Height = Application.GetRealHeight(modeItem_Height),
                Tag = ZigBee.Device.AC.AcMode.FanOnly
            };
            changeModeFL.AddChidren(mode_Fan);
            if (ac.listSupportMode[2] == 1)
            {
                changeModeFL.AddChidren(mode_Fan);
            }
            mode_Fan.Init("AC/Mode_Fan.png", "AC/Mode_FanSelected.png", Language.StringByID(R.MyInternationalizationString.Mode_FanOnly), false);
            mode_Auto.TitleButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
            mode_Auto.IconButton.MouseUpEventHandler += ChangeMode_MouseUpEvent;
@@ -977,11 +1066,11 @@
            {
                mode = ZigBee.Device.AC.AcMode.Heat;
            }
            else if(tag =="Dry")
            else if (tag == "Dry")
            {
                mode = ZigBee.Device.AC.AcMode.Dry;
            }
            else if(tag == "FanOnly")
            else if (tag == "FanOnly")
            {
                mode = ZigBee.Device.AC.AcMode.FanOnly;
            }
@@ -1006,35 +1095,228 @@
            modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode);
            currentModeBtn.Text = ACControlBase.GetModeNameByMode(acMode);
            ac.currentSystemMode = (int)acMode;
            currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} °C";
            (device.CommonDevice as ZigBee.Device.AC).SetSystemModeAsync(acMode);
            mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
            ac.SetSystemModeAsync(acMode);
        }
        #endregion
        #region ◆ 开关__________________________
        #region ◆ 切换扫风______________________
        /// <summary>
        /// 开关
        /// 切换扫风
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void Switch_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
        private void ShowChangeFanSwing_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
        {
            switchBtn.IsSelected = !switchBtn.IsSelected;
            if (switchBtn.IsSelected == true)
            int fanItem_X = 80;
            int fanItem_Height = 150;
            int fanItem_Width = 449;
            fanModeDialog = new Dialog();
            fanModeDialog.Show();
            var closeBGview = new FrameLayout();
            fanModeDialog.AddChidren(closeBGview);
            closeBGview.MouseUpEventHandler += (send1, e1) =>
            {
                ac.Open();
                modeBtn.IsSelected = true;
                fanModeBtn.IsSelected = true;
            }
            else
                fanModeDialog.Close();
            };
            var changeFanModeBG = new Button()
            {
                ac.Close();
                modeBtn.IsSelected = false;
                fanModeBtn.IsSelected = false;
                X = Application.GetRealWidth(35),
                Y = Application.GetRealHeight(297),
                Height = Application.GetRealHeight(1089),
                Width = Application.GetRealWidth(fanItem_Width),
                UnSelectedImagePath = "AC/SwingBackground.png"
            };
            closeBGview.AddChidren(changeFanModeBG);
            var changeFanModeFL = new FrameLayout()
            {
                X = Application.GetRealWidth(35),
                Y = Application.GetRealHeight(297),
                Height = Application.GetRealHeight(1050),
                Width = Application.GetRealWidth(fanItem_Width),
                Radius = CommonPage.BigFormRadius,
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
            };
            closeBGview.AddChidren(changeFanModeFL);
            var changeFanBtn = new Button()
            {
                X = Application.GetRealWidth(fanItem_X),
                Width = Application.GetRealWidth(fanItem_Width - fanItem_X),
                Height = Application.GetRealHeight(fanItem_Height),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextID = R.MyInternationalizationString.SelectSwing,
                TextAlignment = TextAlignment.CenterLeft
            };
            changeFanModeFL.AddChidren(changeFanBtn);
            var swing_First = new CommonForm.ACLeftIconButtonRowLayout()
            {
                Y = changeFanBtn.Bottom,
                Width = Application.GetRealWidth(fanItem_Width),
                Height = Application.GetRealHeight(fanItem_Height),
                Tag = ZigBee.Device.AC.FanSwingMode.First
            };
            changeFanModeFL.AddChidren(swing_First);
            swing_First.Init("AC/Swing_1.png", "AC/Swing_1Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_First));
            var swing_Second = new CommonForm.ACLeftIconButtonRowLayout()
            {
                Y = swing_First.Bottom,
                Width = Application.GetRealWidth(fanItem_Width),
                Height = Application.GetRealHeight(fanItem_Height),
                Tag = ZigBee.Device.AC.FanSwingMode.Second
            };
            changeFanModeFL.AddChidren(swing_Second);
            swing_Second.Init("AC/Swing_2.png", "AC/Swing_2Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Second));
            var swing_Thrid = new CommonForm.ACLeftIconButtonRowLayout()
            {
                Y = swing_Second.Bottom,
                Width = Application.GetRealWidth(fanItem_Width),
                Height = Application.GetRealHeight(fanItem_Height),
                Tag = ZigBee.Device.AC.FanSwingMode.Thrid
            };
            changeFanModeFL.AddChidren(swing_Thrid);
            swing_Thrid.Init("AC/Swing_3.png", "AC/Swing_3Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Thrid));
            var swing_Fourth = new CommonForm.ACLeftIconButtonRowLayout()
            {
                Y = swing_Thrid.Bottom,
                Width = Application.GetRealWidth(fanItem_Width),
                Height = Application.GetRealHeight(fanItem_Height),
                Tag = ZigBee.Device.AC.FanSwingMode.Fourth
            };
            changeFanModeFL.AddChidren(swing_Fourth);
            swing_Fourth.Init("AC/Swing_4.png", "AC/Swing_4Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Fourth));
            var swing_Fifth = new CommonForm.ACLeftIconButtonRowLayout()
            {
                Y = swing_Fourth.Bottom,
                Width = Application.GetRealWidth(fanItem_Width),
                Height = Application.GetRealHeight(fanItem_Height),
                Tag = ZigBee.Device.AC.FanSwingMode.Fifth
            };
            changeFanModeFL.AddChidren(swing_Fifth);
            swing_Fifth.Init("AC/Swing_5.png", "AC/Swing_5Selected.png", Language.StringByID(R.MyInternationalizationString.Swing_Fifth));
            var swing_Auto = new CommonForm.ACLeftIconButtonRowLayout()
            {
                Y = swing_Fifth.Bottom,
                Width = Application.GetRealWidth(fanItem_Width),
                Height = Application.GetRealHeight(fanItem_Height),
                Tag = ZigBee.Device.AC.FanSwingMode.Auto
            };
            changeFanModeFL.AddChidren(swing_Auto);
            swing_Auto.Init("AC/Swing_Auto.png", "AC/Swing_AutoSelected.png", Language.StringByID(R.MyInternationalizationString.Swing_Auto),false);
            swing_First.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_First.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Second.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Second.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Thrid.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Thrid.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Fourth.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Fourth.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Fifth.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Fifth.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Auto.TitleButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            swing_Auto.IconButton.MouseUpEventHandler += ChangeFanSwing_MouseUpEvent;
            if (ACControlBase.IsOpen(ac))
            {
                if (ac.currentFanSwingMode == 0)
                {
                    swing_First.SetSelectedStatu();
                }
                else if (ac.currentFanSwingMode == 1)
                {
                    swing_Second.SetSelectedStatu();
                }
                else if (ac.currentFanSwingMode == 2)
                {
                    swing_Thrid.SetSelectedStatu();
                }
                else if (ac.currentFanSwingMode == 3)
                {
                    swing_Fourth.SetSelectedStatu();
                }
                else if (ac.currentFanSwingMode == 4)
                {
                    swing_Fifth.SetSelectedStatu();
                }
                else if (ac.currentFanSwingMode == 7)
                {
                    swing_Auto.SetSelectedStatu();
                }
            }
        }
        /// <summary>
        /// 切换扫风
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void ChangeFanSwing_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
        {
            var tag = (sender as Button).Tag.ToString();
            ZigBee.Device.AC.FanSwingMode mode = ZigBee.Device.AC.FanSwingMode.Auto;
            if (tag == "First")
            {
                mode = ZigBee.Device.AC.FanSwingMode.First;
            }
            else if (tag == "Second")
            {
                mode = ZigBee.Device.AC.FanSwingMode.Second;
            }
            else if (tag == "Thrid")
            {
                mode = ZigBee.Device.AC.FanSwingMode.Thrid;
            }
            else if(tag=="Fourth")
            {
                mode = ZigBee.Device.AC.FanSwingMode.Fourth;
            }
            else if (tag == "Fifth")
            {
                mode = ZigBee.Device.AC.FanSwingMode.Fifth;
            }
            ChangeFanSwing(mode);
        }
        /// <summary>
        /// 切换扫风
        /// </summary>
        /// <param name="fanSwingMode">Fan mode.</param>
        private void ChangeFanSwing(ZigBee.Device.AC.FanSwingMode fanSwingMode)
        {
            fanModeDialog.Close();
            if (ACControlBase.IsOpen(ac) == false)
            {
                ACControlBase.ShowACIsCloseTip();
                return;
            }
            FanSwingModeBtn.IsSelected = true;
            FanSwingModeBtn.SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode);
            FanSwingModeBtn.UnSelectedImagePath = ACControlBase.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode);
            ac.currentFanSwingMode = (int)fanSwingMode;
            ac.SetFanSwingAsyncMode(fanSwingMode);
        }
        #endregion
@@ -1051,29 +1333,26 @@
                ACControlBase.ShowACIsCloseTip();
                return;
            }
            //cool  //dry
            if (ac.currentSystemMode == 3 || ac.currentSystemMode==8)
            if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
            {
                if(ac.currentCoolingSetpoint>=ACControlBase.Temperature_High)
                if (ac.currentCoolingSetpoint >= ACControlBase.Temperature_High)
                {
                    return;
                }
                ac.currentCoolingSetpoint += 1;
                ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint*100);
                currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C";
                ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100);
                mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
            }
            //heat
            else if (ac.currentSystemMode == 4)
            {
                if(ac.currentHeatingSetpoint>=ACControlBase.Temperature_High)
                if (ac.currentHeatingSetpoint >= ACControlBase.Temperature_High)
                {
                    return;
                }
                ac.currentHeatingSetpoint += 1;
                ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint*100);
                currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C";
                ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100);
                mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
            }
            //auto
            else if (ac.currentSystemMode == 1)
            {
                if (ac.currentAutoSetpoint >= ACControlBase.Temperature_High)
@@ -1081,11 +1360,9 @@
                    return;
                }
                ac.currentAutoSetpoint += 1;
                ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint*100);
                currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C";
                ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100);
                mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
            }
        }
        #endregion
@@ -1104,7 +1381,6 @@
                ACControlBase.ShowACIsCloseTip();
                return;
            }
            //cool //dry
            if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
            {
                if (ac.currentCoolingSetpoint <= ACControlBase.Temperature_Low)
@@ -1112,11 +1388,9 @@
                    return;
                }
                ac.currentCoolingSetpoint -= 1;
                ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint*100);
                currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C";
                ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100);
                mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
            }
            //heat
            else if (ac.currentSystemMode == 4)
            {
                if (ac.currentHeatingSetpoint <= ACControlBase.Temperature_Low)
@@ -1124,11 +1398,9 @@
                    return;
                }
                ac.currentHeatingSetpoint -= 1;
                ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint*100);
                currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C";
                ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100);
                mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
            }
            //auto
            else if (ac.currentSystemMode == 1)
            {
                if (ac.currentAutoSetpoint <= ACControlBase.Temperature_Low)
@@ -1136,16 +1408,74 @@
                    return;
                }
                ac.currentAutoSetpoint -= 1;
                ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint*100);
                currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C";
                ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100);
                mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
            }
        }
        #endregion
        #region ◆ 收藏__________________________
        #region ◆ 控制反馈_________________________
        /// <summary>
        /// 显示设备控制状态
        /// </summary>
        /// <param name="command">Command.</param>
        /// <param name="objValue">Object value.</param>
        private void UpdateDeviceControllStatu(string command, object objValue)
        {
            if (command != "DeviceDefaultAck" || objValue == null)
            {
                return;
            }
            var tempDevice = (CommonDevice)objValue;
            if (tempDevice.DeviceEpoint != this.device.CommonDevice.DeviceEpoint || tempDevice.DeviceAddr != this.device.CommonDevice.DeviceAddr)
            {
                //不是当前设备的推送,则不处理
                return;
            }
            //标记已经发送控制命令到网关
            sendedControlCommand = true;
            //成功不提示
            //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success);
        }
        /// <summary>
        /// 移除更新控制设备的action
        /// </summary>
        private void RemoveUpdateControlDeviceStatuAction()
        {
            if (zbGateway != null)
            {
                zbGateway.ReportAction -= UpdateDeviceControllStatu;
            }
        }
        #endregion
        #region ◆ 更多设置________________________
        /// <summary>
        /// 更多设置
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        private void More(object sender, MouseEventArgs e)
        {
            var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
            UserView.HomePage.Instance.AddChidren(detailInfo);
            UserView.HomePage.Instance.PageIndex += 1;
            detailInfo.Show(device, room);
            detailInfo.action = () =>
            {
                Show(device, room);
            };
        }
        #endregion
        #region ◆ 收藏到主页_______________________
        /// <summary>
        /// 收藏到主页
        /// </summary>
@@ -1153,7 +1483,6 @@
        /// <param name="e">E.</param>
        private void Collection(object sender, MouseEventArgs e)
        {
            //collection
            if (collectionBtn.IsSelected)
            {
                Shared.Common.Room.Lists[0].DeleteDevice(device.FileName);
@@ -1168,19 +1497,16 @@
        #endregion
        #region ◆ 绑定按钮_______________________
        #region ◆ 回到主页________________________
        /// <summary>
        /// 绑定按钮的事件
        /// 回到主页
        /// </summary>
        private void BindEvent()
        /// <param name="sender">Sender.</param>
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void BackToRoomHandler(object sender, MouseEventArgs mouseEventArgs)
        {
            switchBtn.MouseUpEventHandler += Switch_MouseUpEvent;
            reduceTemperatureBtn.MouseUpEventHandler += Reduce_MouseUpEvent;
            addTemperatureBtn.MouseUpEventHandler += Add_MouseUpEvent;
            collectionBtn.MouseUpEventHandler += Collection;
            moreBtn.MouseUpEventHandler += MoreEvent;
            fanModeBtn.MouseUpEventHandler += ShowChangeFan_MouseUpEvent;
            modeBtn.MouseUpEventHandler += ShowChangeMode_MouseUpEvent;
            //backToRoom
        }
        #endregion