gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs
@@ -1,5 +1,7 @@
using System;
using Shared.Common;
using Shared.Phone.Device.CommonForm;
using Shared.Phone.Device.DeviceLogic;
using Shared.Phone.UserView;
using ZigBee.Device;
@@ -9,41 +11,14 @@
    {
        #region ◆ 变量__________________________
        /// <summary>
        /// 设备是否在线标识--Online
        /// The action.
        /// </summary>
        private readonly string DeviceStatus_Online = "Online";
        public HorizontalSeekBar SeekBar;
        public Button seekBarTitle;
        public Action action;
        public Button rollerShadeIMG;
        public Action<DeviceUI,Common.Room> action;
        /// <summary>
        /// 收藏按钮
        /// </summary>
        public Button collectionBtn;
        /// <summary>
        /// 更多设置
        /// </summary>
        private Button moreBtn;
        /// <summary>
        /// 下、关
        /// </summary>
        private Button downBtn;
        /// <summary>
        /// 停
        /// </summary>
        private Button stopBtn;
        /// <summary>
        /// 上、开
        /// </summary>
        private Button upBtn;
        /// <summary>
        /// 房间
        /// </summary>
        private Button roomBtn;
        /// <summary>
        /// 房间名
        /// </summary>
        private Button roomName;
        private Button collectionBtn;
        /// <summary>
        /// 传过来的设备
        /// </summary>
@@ -52,6 +27,15 @@
        /// 传过来的房间
        /// </summary>
        private Shared.Common.Room room;
        /// <summary>
        /// 房间
        /// </summary>
        private Button roomBtn;
        /// <summary>
        /// 房间名
        /// </summary>
        private Button roomName;
        /// <summary>
        /// 网关
        /// </summary>
@@ -62,9 +46,52 @@
        private bool sendedControlCommand = false;
        /// <summary>
        ///延时 300毫秒
        /// bodyFrameLayout
        /// </summary>
        private int sleepSpan = 300;
        private FrameLayout bodyFrameLayout;
        /// <summary>
        /// StatuBtn
        /// </summary>
        private Button StatuBtn;
        /// <summary>
        /// OpenOrUpBtn
        /// </summary>
        public Button OpenOrUpBtn;
        /// <summary>
        /// OpenOrUpBtn
        /// </summary>
        public Button CloseOrDownBtn;
        /// <summary>
        /// StopBtn
        /// </summary>
        public Button StopBtn;
        /// <summary>
        /// 开合帘
        /// </summary>
        private CurtainSeekBar curtainSeekBar = new CurtainSeekBar { };
        /// <summary>
        /// 卷帘
        /// </summary>
        private CurtainRollSeekBar curtainRollSeekBar = new CurtainRollSeekBar { };
        /// <summary>
        /// IsDrawerLockMode
        /// </summary>
        public bool IsDrawerLockMode;
        /// <summary>
        /// ProgressBtn
        /// </summary>
        Button ProgressBtn;
        /// <summary>
        /// ProgressBtnY
        /// </summary>
        int ProgressBtnY;
        /// <summary>
        /// ProgressBtnX
        /// </summary>
        int ProgressBtnX;
        #endregion
@@ -96,7 +123,7 @@
                {
                    try
                    {
                        var deviceUI = SeekBar.Tag as DeviceUI;
                        var deviceUI = this.device;
                        //设备为空
                        if (deviceUI.CommonDevice == null)
                        {
@@ -115,14 +142,21 @@
                                var rollerShade = deviceUI.CommonDevice as Rollershade;
                                rollerShade.DeviceStatusReport = common.DeviceStatusReport;
                                rollerShade.WcdCurrentPositionLiftPercentage = common.DeviceStatusReport.AttriBute[0].AttriButeData;
                                SeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage;
                                seekBarTitle.Text = $"{SeekBar.Progress} %";
                                StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} { deviceUI.GetDeviceStatu()}";
                                if(rollerShade.WcdType==0)
                                {
                                    curtainRollSeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage;
                                }
                                else if(rollerShade.WcdType==4)
                                {
                                    curtainSeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage;
                                }
                                rollerShade.LastDateTime = DateTime.Now;
                            }
                            else if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0)
                            {
                                //窗帘类型
                                var rollerShade = deviceUI.CommonDevice as Rollershade;
                                ////窗帘类型
                                var rollerShade = device.CommonDevice as Rollershade;
                                rollerShade.DeviceStatusReport = common.DeviceStatusReport;
                                rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData;
                                rollerShade.LastDateTime = DateTime.Now;
@@ -131,10 +165,10 @@
                        //***新改***设备状态上报中,当CluterID=3,证明设备在线,直接标记
                        else if (common.DeviceStatusReport.CluterID == 3)
                        {
                            var rollerShade = deviceUI.CommonDevice as Rollershade;
                            rollerShade.IsOnline = 1;
                            rollerShadeIMG.IsSelected = rollerShade.IsOnline == 1;
                            rollerShade.LastDateTime = DateTime.Now;
                            //var rollerShade = deviceUI.CommonDevice as Rollershade;
                            //rollerShade.IsOnline = 1;
                            //rollerShadeIMG.IsSelected = rollerShade.IsOnline == 1;
                            //rollerShade.LastDateTime = DateTime.Now;
                        }
                    }
                    catch (Exception ex)
@@ -149,21 +183,21 @@
                {
                    try
                    {
                        var deviceUI = SeekBar.Tag as DeviceUI;
                        //设备为空
                        if (deviceUI.CommonDevice == null)
                        {
                            return;
                        }
                        //是否为当前设备
                        if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
                        {
                            return;
                        }
                        var rollerShade = deviceUI.CommonDevice as Rollershade;
                        rollerShade.IsOnline = common.IsOnline;
                        rollerShadeIMG.IsSelected = rollerShade.IsOnline == 1;
                        rollerShade.LastDateTime = DateTime.Now;
                        //var deviceUI = SeekBar.Tag as DeviceUI;
                        ////设备为空
                        //if (deviceUI.CommonDevice == null)
                        //{
                        //    return;
                        //}
                        ////是否为当前设备
                        //if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
                        //{
                        //    return;
                        //}
                        //var rollerShade = deviceUI.CommonDevice as Rollershade;
                        //rollerShade.IsOnline = (common as Rollershade).IsOnline;
                        //rollerShadeIMG.IsSelected = rollerShade.IsOnline == 1;
                        //rollerShade.LastDateTime = DateTime.Now;
                    }
                    catch (Exception ex)
                    {
@@ -212,9 +246,13 @@
        {
            UserView.HomePage.Instance.ScrollEnabled = true;
            ZigBee.Device.ZbGateway.StatusList.Remove(this);
            action();
            action(device,room);
            action = null;
            RemoveUpdateControlDeviceStatuAction();
            if (IsDrawerLockMode)
            {
                CommonPage.Instance.IsDrawerLockMode = false;
            }
            base.RemoveFromParent();
        }
@@ -223,36 +261,20 @@
        #region ◆ 显示界面________________________
        /// <summary>
        /// 显示卷帘控制界面
        /// 显示界面
        /// </summary>
        public void Show(DeviceUI device, Shared.Common.Room room)
        /// <param name="dev">Device.</param>
        /// <param name="room">Room.</param>
        public void Show(DeviceUI dev, Shared.Common.Room room)
        {
            #region topview
            var topBGView = new FrameLayout()
            {
                Height = Application.GetRealHeight(CommonPage.Navigation_Height),
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
            };
            AddChidren(topBGView);
            var topView = new FrameLayout()
            {
                Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),
                Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,
            };
            AddChidren(topView);
            moreBtn = new Device.CommonForm.SelectedStatuButton()
            {
                X = Application.GetRealWidth(CommonPage.AppRealWidth - 150),
                Width = Application.GetMinReal(110),
                Height = Application.GetMinReal(110),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "Item/More.png",
                SelectedImagePath = "Item/MoreSelected.png",
            };
            topView.AddChidren(moreBtn);
            var back = new Device.CommonForm.BackButton() { };
            topView.AddChidren(back);
            back.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
            if (device == null || device.CommonDevice == null || room == null)
            {
                return;
            }
            this.device = device;
            this.zbGateway = this.device.CommonDevice.Gateway;
            device = dev;
            zbGateway = this.device.CommonDevice.Gateway;
            this.room = room;
            AddTop();
            AddBodyView(device);
            var rollerShade = device.CommonDevice as ZigBee.Device.Rollershade;
            //不上非远程
@@ -264,8 +286,7 @@
            {
                UserHomeView.ReadStatus(rollerShade, () =>
                {
                    rollerShade.ReadWcdCurrentPositionLiftPercentage();
                    rollerShade.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
                    ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice);
                });
            }
            else
@@ -273,168 +294,11 @@
                //防止短时间内多次读取
                if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                {
                    rollerShade.ReadWcdCurrentPositionLiftPercentage();
                    rollerShade.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
                    ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice);
                }
            }
            #endregion
            #region midFL
            var midFL = new FrameLayout()
            {
                Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
                Y = topView.Bottom,
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
            };
            this.AddChidren(midFL);
            var itemView = new FrameLayout()
            {
                Y = Application.GetRealHeight(50),
                Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft*2),
                Height = midFL.Height - Application.GetRealHeight(100),
                Radius = CommonPage.BigFormRadius,
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
            };
            midFL.AddChidren(itemView);
            var rollerShadeView = new FrameLayout()
            {
                X = 2,
                Y = 2,
                Width = itemView.Width - 4,
                Height = itemView.Height - Application.GetRealHeight(130),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
                Tag=device
            };
            itemView.AddChidren(rollerShadeView);
            collectionBtn = new Button()
            {
                X = rollerShadeView.Width - Application.GetRealWidth(130),
                Y = Application.GetRealHeight(20),
                Width = Application.GetMinReal(110),
                Height = Application.GetMinReal(110),
                UnSelectedImagePath = "Item/Collection.png",
                SelectedImagePath = "Item/CollectionSelected.png"
            };
            rollerShadeView.AddChidren(collectionBtn);
             rollerShadeIMG = new Button()
            {
                Y = Application.GetRealHeight(80),
                Height = Application.GetMinRealAverage(240),
                Width = Application.GetMinRealAverage(240),
                Gravity = Gravity.CenterHorizontal,
                UnSelectedImagePath = device.IconPath,
                SelectedImagePath = device.OnlineIconPath,
                IsSelected=rollerShade.IsOnline==1,
                Tag=DeviceStatus_Online
            };
            rollerShadeView.AddChidren(rollerShadeIMG);
            var rollerShadeName = new Button()
            {
                Y = rollerShadeIMG.Bottom,
                Height = Application.GetRealHeight(85),
                Width = rollerShadeView.Width - Application.GetRealWidth(100),
                Gravity = Gravity.CenterHorizontal,
                Text = device.CommonDevice.DeviceEpointName,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor
            };
            rollerShadeView.AddChidren(rollerShadeName);
            //滑条
            SeekBar = new HorizontalSeekBar()
            {
                Y = rollerShadeName.Bottom + Application.GetRealHeight(350),
                Width = rollerShadeView.Width - Application.GetRealWidth(100),
                Height = Application.GetRealHeight(80),
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = ZigbeeColor.Current.GXCSliderUnSelectedColor,
                ThumbColor = ZigbeeColor.Current.GXCButtonBlueColor,
                BorderColor = ZigbeeColor.Current.GXCButtonBlueColor,
                ProgressColor = ZigbeeColor.Current.GXCButtonBlueColor,
                Max = 100,
                Tag=device,
                Progress = rollerShade.WcdCurrentPositionLiftPercentage,
                SleepTime=sleepSpan
            };
            rollerShadeView.AddChidren(SeekBar);
            seekBarTitle = new Button()
            {
                Y = rollerShadeName.Bottom + Application.GetRealHeight(250),
                Width = Application.GetRealWidth(300),
                Height = Application.GetRealHeight(80),
                Gravity = Gravity.CenterHorizontal,
                Text = $"{SeekBar.Progress}%",
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                Tag=device
            };
            rollerShadeView.AddChidren(seekBarTitle);
            downBtn = new Device.CommonForm.SelectedStatuButton()
            {
                X = Application.GetRealWidth(50),
                Y = Application.GetRealHeight(300) + SeekBar.Bottom,
                Width = Application.GetMinRealAverage(160),
                Height = Application.GetMinRealAverage(160),
                UnSelectedImagePath = "WindowCovering/RollerShadeClose.png",
                SelectedImagePath = "WindowCovering/RollerShadeCloseSelected.png",
                //IsSelected = !((device.CommonDevice as ZigBee.Device.Rollershade).WcdCurrentPositionLiftPercentage > 0)
            };
            rollerShadeView.AddChidren(downBtn);
            stopBtn = new Device.CommonForm.SelectedStatuButton()
            {
                X = Application.GetRealWidth(200) + downBtn.Right,
                Y = Application.GetRealHeight(300) + SeekBar.Bottom,
                Width = Application.GetMinRealAverage(160),
                Height = Application.GetMinRealAverage(160),
                UnSelectedImagePath = "WindowCovering/RollerShadeStop.png",
                SelectedImagePath = "WindowCovering/RollerShadeStopSelected.png",
            };
            rollerShadeView.AddChidren(stopBtn);
            upBtn = new Device.CommonForm.SelectedStatuButton()
            {
                X = Application.GetRealWidth(200) + stopBtn.Right,
                Y = Application.GetRealHeight(300) + SeekBar.Bottom,
                Width = Application.GetMinRealAverage(160),
                Height = Application.GetMinRealAverage(160),
                UnSelectedImagePath = "WindowCovering/RollerShadeOpen.png",
                SelectedImagePath = "WindowCovering/RollerShadeOpenSelected.png",
                //IsSelected = (device.CommonDevice as ZigBee.Device.Rollershade).WcdCurrentPositionLiftPercentage > 0
            };
            rollerShadeView.AddChidren(upBtn);
            roomBtn = new Button()
            {
                X = Application.GetRealWidth(50),
                Y = Application.GetRealHeight(25) + rollerShadeView.Bottom,
                Width = Application.GetMinReal(80),
                Height = Application.GetMinReal(80),
                UnSelectedImagePath = "Item/Room.png",
                SelectedImagePath = "Item/RoomSelected.png"
            };
            itemView.AddChidren(roomBtn);
            roomName = new Button()
            {
                X = roomBtn.Right + Application.GetRealWidth(20),
                Y = roomBtn.Y,
                Width = Application.GetRealWidth(400),
                Height = Application.GetRealHeight(80),
                Text = room.Name,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor
            };
            itemView.AddChidren(roomName);
            var dev =Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
            if (dev == null)
            if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
            {
                collectionBtn.IsSelected = false;
            }
@@ -443,53 +307,202 @@
                collectionBtn.IsSelected = true;
            }
            if (rollerShade.WcdType == -1)
            BindEvent();
        }
        #endregion
        #region ◆ Add______________________________
        /// <summary>
        /// AddTop
        /// </summary>
        public void AddTop()
        {
            var top = new TopFrameLayout();
            AddChidren(top);
            top.InitTopview();
            top.backButton.MouseUpEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
            var moreBtn = new Button
            {
                X = Application.GetRealWidth(953),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "Item/More.png"
            };
            top.topView.AddChidren(moreBtn);
            moreBtn.MouseUpEventHandler += More;
        }
        /// <summary>
        /// AddBodyView
        /// </summary>
        public void AddBodyView(DeviceUI device)
        {
            bodyFrameLayout = new FrameLayout()
            {
                Y = Application.GetRealHeight(184),
                Height = Application.GetRealHeight(1737),
                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
            };
            AddChidren(bodyFrameLayout);
            var itemView = new FrameLayout()
            {
                Y = Application.GetRealHeight(115),
                Width = Application.GetRealWidth(965),
                Height = Application.GetRealHeight(1316),
                Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius),
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
            };
            bodyFrameLayout.AddChidren(itemView);
            collectionBtn = new Button()
            {
                X = Application.GetRealWidth(850),
                Y = Application.GetRealHeight(46),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                UnSelectedImagePath = "Item/Collection.png",
                SelectedImagePath = "Item/CollectionSelected.png"
            };
            itemView.AddChidren(collectionBtn);
            var deviceNameBtn = new Button()
            {
                Y = Application.GetRealHeight(46),
                Width = Application.GetRealWidth(500),
                Height = Application.GetRealHeight(60),
                Gravity = Gravity.CenterHorizontal,
                Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextSize = 15,
                IsBold=true
            };
            itemView.AddChidren(deviceNameBtn);
            StatuBtn = new Button
            {
                Y = Application.GetRealHeight(118),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(60),
                Gravity = Gravity.CenterHorizontal,
                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
                Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}",
                TextSize = 10
            };
            itemView.AddChidren(StatuBtn);
            OpenOrUpBtn = new Button
            {
                X = Application.GetRealWidth(253),
                Y = Application.GetRealHeight(994),
                Width = Application.GetMinRealAverage(81),
                Height = Application.GetMinRealAverage(81)
            };
            itemView.AddChidren(OpenOrUpBtn);
            OpenOrUpBtn.MouseUpEventHandler += (sender, e) =>
            {
                (device.CommonDevice as Rollershade).CurtainUpDownStopControl(0);
            };
            StopBtn = new Button
            {
                X = Application.GetRealWidth(441),
                Y=Application.GetRealHeight(994),
                Width = Application.GetMinRealAverage(81),
                Height = Application.GetMinRealAverage(81),
                SelectedImagePath = "RollerShade/StopSelected.png",
                UnSelectedImagePath = "RollerShade/Stop.png",
            };
            itemView.AddChidren(StopBtn);
            StopBtn.MouseUpEventHandler += (sender, e) =>
            {
                (device.CommonDevice as Rollershade).CurtainUpDownStopControl(2);
            };
            CloseOrDownBtn = new Button
            {
                X = Application.GetRealWidth(631),
                Y = Application.GetRealHeight(994),
                Width = Application.GetMinRealAverage(81),
                Height = Application.GetMinRealAverage(81)
            };
            itemView.AddChidren(CloseOrDownBtn);
            CloseOrDownBtn.MouseUpEventHandler += (sender, e) =>
            {
                (device.CommonDevice as Rollershade).CurtainUpDownStopControl(1);
            };
            if ((device.CommonDevice as Rollershade).WcdType == -1)
            {
                CommonPage.Loading.Start();
                new System.Threading.Thread(() =>
                {
                    ZigBee.Device.Rollershade.ReadWcdTypeAction(rollerShade, () =>
                    Rollershade.ReadWcdTypeAction(device.CommonDevice, () =>
                    {
                        Application.RunOnMainThread(() =>
                        {
                            if (rollerShade.WcdType == 0)
                            {
                                downBtn.UnSelectedImagePath = "WindowCovering/RollerShadeDown.png";
                                downBtn.SelectedImagePath = "WindowCovering/RollerShadeDownSelected.png";
                                upBtn.UnSelectedImagePath = "WindowCovering/RollerShadeUp.png";
                                upBtn.SelectedImagePath = "WindowCovering/RollerShadeUpSelected.png";
                            }
                            else
                            {
                                downBtn.UnSelectedImagePath = "WindowCovering/RollerShadeClose.png";
                                downBtn.SelectedImagePath = "WindowCovering/RollerShadeCloseSelected.png";
                                upBtn.UnSelectedImagePath = "WindowCovering/RollerShadeOpen.png";
                                upBtn.SelectedImagePath = "WindowCovering/RollerShadeOpenSelected.png";
                            }
                            SetRollerShadeIcon((device.CommonDevice as Rollershade).WcdType);
                            CommonPage.Loading.Hide();
                        });
                    });
                })
                { IsBackground = true }.Start();
            }
            else if(rollerShade.WcdType == 0)
            {
                downBtn.UnSelectedImagePath = "WindowCovering/RollerShadeDown.png";
                downBtn.SelectedImagePath = "WindowCovering/RollerShadeDownSelected.png";
                upBtn.UnSelectedImagePath = "WindowCovering/RollerShadeUp.png";
                upBtn.SelectedImagePath = "WindowCovering/RollerShadeUpSelected.png";
            }
            else
            {
                downBtn.UnSelectedImagePath = "WindowCovering/RollerShadeClose.png";
                downBtn.SelectedImagePath = "WindowCovering/RollerShadeCloseSelected.png";
                upBtn.UnSelectedImagePath = "WindowCovering/RollerShadeOpen.png";
                upBtn.SelectedImagePath = "WindowCovering/RollerShadeOpenSelected.png";
            }
            #endregion
            SetCurtainType(itemView, (device.CommonDevice as Rollershade).WcdType);
            BindEvent();
            var roomBG = new Button
            {
                Y = Application.GetRealHeight(1178 - 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(1178 - 50),
                Height = Application.GetRealHeight(50),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
            };
            itemView.AddChidren(roomBG2);
            roomBtn = new Button()
            {
                X = Application.GetRealWidth(CommonFormResouce.X_Left),
                Y = Application.GetRealHeight(1207),
                Width = Application.GetMinReal(80),
                Height = Application.GetMinReal(80),
                UnSelectedImagePath = "Item/Room.png"
            };
            itemView.AddChidren(roomBtn);
            roomName = new Button()
            {
                X = Application.GetRealWidth(150),
                Y = Application.GetRealHeight(1224),
                Width = Application.GetRealWidth(400),
                Height = Application.GetRealHeight(50),
                Text = room.Name,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
                TextSize = 12
            };
            itemView.AddChidren(roomName);
        }
        #endregion
@@ -501,31 +514,15 @@
        /// </summary>
        private void BindEvent()
        {
            upBtn.MouseUpEventHandler += Up;
            stopBtn.MouseUpEventHandler += Stop;
            downBtn.MouseUpEventHandler += Down;
            SeekBar.ProgressChanged += SeekBar_ProgressChange;
            //upBtn.MouseUpEventHandler += Up;
            //stopBtn.MouseUpEventHandler += Stop;
            //downBtn.MouseUpEventHandler += Down;
            collectionBtn.MouseUpEventHandler += Collection;
            moreBtn.MouseUpEventHandler += More;
            roomBtn.MouseUpEventHandler += BackToRoomHandler;
            roomName.MouseUpEventHandler += BackToRoomHandler;
        }
        #endregion
        #region ◆ 控制___________________________
        /// <summary>
        /// 滑条移动发送命令
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void SeekBar_ProgressChange(object sender, int mouseEventArgs)
        {
            seekBarTitle.Text = $"{SeekBar.Progress}%";
            (device.CommonDevice as ZigBee.Device.Rollershade).WcdGoToTiltValue(SeekBar.Progress);
        }
        #region ◆ 控制__________________________
        /// <summary>
        /// 上、开
@@ -656,10 +653,193 @@
            UserView.HomePage.Instance.AddChidren(detailInfo);
            UserView.HomePage.Instance.PageIndex += 1;
            detailInfo.Show(device, room);
            detailInfo.action = () =>
            detailInfo.EditAction += (curDev,curRoom) =>
            {
                Show(device, room);
                Show(curDev, curRoom);
            };
        }
        /// <summary>
        /// SetCurtainType
        /// </summary>
        /// <param name="layout"></param>
        /// <param name="type"></param>
        private void SetCurtainType(FrameLayout layout, int type)
        {
            SetRollerShadeIcon(type);
            SetRollerSeekBar(layout, type);
        }
        /// <summary>
        /// WcdType=4:开合帘
        /// WcdType=0:卷帘
        /// </summary>
        /// <param name="type"></param>
        private void SetRollerShadeIcon(int type)
        {
            if (type == 0)
            {
                OpenOrUpBtn.UnSelectedImagePath = "RollerShade/Up.png";
                OpenOrUpBtn.SelectedImagePath = "RollerShade/UpSelected.png";
                CloseOrDownBtn.UnSelectedImagePath = "RollerShade/Down.png";
                CloseOrDownBtn.SelectedImagePath = "RollerShade/DownSelected.png";
            }
            else
            {
                OpenOrUpBtn.UnSelectedImagePath = "RollerShade/Open.png";
                OpenOrUpBtn.SelectedImagePath = "RollerShade/OpenSelected.png";
                CloseOrDownBtn.UnSelectedImagePath = "RollerShade/Close.png";
                CloseOrDownBtn.SelectedImagePath = "RollerShade/CloseSelected.png";
            }
        }
        /// <summary>
        /// SetRollerSeekBar
        /// </summary>
        /// <param name="layout"></param>
        /// <param name="type"></param>
        private void SetRollerSeekBar(FrameLayout layout,int type)
        {
            if(type == 0)
            {
                curtainRollSeekBar.Y = Application.GetRealHeight(300);
                curtainRollSeekBar.Width = Application.GetRealWidth(438);
                curtainRollSeekBar.Height = Application.GetRealHeight(576);
                curtainRollSeekBar.Gravity = Gravity.CenterHorizontal;
                curtainRollSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage;
                layout.AddChidren(curtainRollSeekBar);
                curtainRollSeekBar.IsProgressTextShow = false;
                curtainRollSeekBar.CurtainPaddingTop = Application.GetRealHeight(110);
                curtainRollSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
                {
                    (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress);
                };
                curtainRollSeekBar.OnStartTrackingTouchEvent += (sender, e) =>
                {
                    OnProgressButtonMove(curtainRollSeekBar.Progress);
                    ProgressBtn.Visible = true;
                };
                curtainRollSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
                {
                    ProgressBtn.Visible = false;
                };
                curtainRollSeekBar.OnProgressChangedEvent += (send2, e2) =>
                {
                    OnProgressButtonMove(e2);
                    //判断是否300ms屏蔽
                    //if (curtainRollSeekBar.IsProgressChangeDelay()) return;
                    //(device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress);
                };
                InitProgressBtn(layout);
            }
            else
            {
                curtainSeekBar.Y = Application.GetRealHeight(334);
                curtainSeekBar.Width = Application.GetRealWidth(570);
                curtainSeekBar.Height = Application.GetRealHeight(513);
                curtainSeekBar.Gravity = Gravity.CenterHorizontal;
                curtainSeekBar.IsProgressTextShow = false;
                curtainSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage;
                layout.AddChidren(curtainSeekBar);
                curtainSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
                {
                    (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainSeekBar.Progress);
                };
                curtainSeekBar.OnStartTrackingTouchEvent += (sender, e) =>
                {
                    OnProgressButtonMoveForCurtain(curtainSeekBar.Progress);
                    ProgressBtn.Visible = true;
                };
                curtainSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
                {
                    ProgressBtn.Visible = false;
                };
                curtainSeekBar.OnProgressChangedEvent += (send2, e2) =>
                {
                    OnProgressButtonMoveForCurtain(e2);
                    //判断是否300ms屏蔽
                    //if (curtainRollSeekBar.IsProgressChangeDelay()) return;
                    //(device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress);
                };
                InitProgressBtnForCurtain(layout);
            }
        }
        /// <summary>
        /// 添加进度按钮
        /// </summary>
        private void InitProgressBtn(FrameLayout layout)
        {
            ProgressBtnY = curtainRollSeekBar.Y - Application.GetMinReal(204);
            ProgressBtn = new Button()
            {
                Y = ProgressBtnY,
                Width = Application.GetMinReal(135),
                Height = Application.GetMinReal(104),
                UnSelectedImagePath = "Item/ProgressBubbles.png",
                Visible = false,
                Gravity = Gravity.CenterHorizontal,
                TextSize=14,
                IsBold=true,
                TextColor=ZigbeeColor.Current.GXCTextWhiteColor
            };
            layout.AddChidren(ProgressBtn);
        }
        /// <summary>
        /// OnProgressButtonMove
        /// </summary>
        private void OnProgressButtonMove(int mProgress)
        {
            ProgressBtn.Y = ProgressBtnY + curtainRollSeekBar.NowProgressY;
            ProgressBtn.Text = mProgress + "%";
        }
        /// <summary>
        /// 添加进度按钮
        /// </summary>
        private void InitProgressBtnForCurtain(FrameLayout layout)
        {
            ProgressBtnX = curtainSeekBar.X - Application.GetMinReal(20);
            ProgressBtn = new Button()
            {
                X = ProgressBtnX,
                Y = curtainSeekBar.Y + curtainSeekBar.Height / 2 - Application.GetMinReal(180),
                Width = Application.GetMinReal(135),
                Height = Application.GetMinReal(104),
                UnSelectedImagePath = "Item/ProgressBubbles.png",
                Visible = false,
                TextSize = 14,
                IsBold = true,
                TextColor = ZigbeeColor.Current.GXCTextWhiteColor
            };
            layout.AddChidren(ProgressBtn);
        }
        /// <summary>
        /// OnProgressButtonMove
        /// </summary>
        private void OnProgressButtonMoveForCurtain(int mProgress)
        {
            ProgressBtn.X = ProgressBtnX + curtainSeekBar.NowProgressX- Application.GetMinReal(5);
            ProgressBtn.Text = mProgress + "%";
        }
        #endregion
@@ -673,15 +853,14 @@
        /// <param name="e">E.</param>
        private void Collection(object sender, MouseEventArgs e)
        {
            //collection
            if (collectionBtn.IsSelected)
            {
                Shared.Common.Room.Lists[0].DeleteDevice(device.FileName);
                Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName);
                collectionBtn.IsSelected = false;
            }
            else
            {
                Shared.Common.Room.Lists[0].AddDevice(device.FileName);
                Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName);
                collectionBtn.IsSelected = true;
            }
        }