HDL Home App 第二版本 旧平台金堂用 正在使用
WJC
2020-03-24 b304a3c78df10b6e9b867e677d3e4719f1d4a7aa
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
old mode 100755 new mode 100644
@@ -8,6 +8,7 @@
using Shared.Phone.Device.AC;
using Shared.Phone.UserCenter.DoorLock;
using Shared.Phone.Device.DeviceLogic;
using Shared.Phone.UserCenter;
namespace Shared.Phone.Device.Category
{
@@ -16,7 +17,6 @@
    /// </summary>
    public class Category : FrameLayout, ZigBee.Common.IStatus
    {
        #region ◆ 变量____________________________
        /// <summary>
        /// The instance.
@@ -25,7 +25,7 @@
        /// <summary>
        /// low_High
        /// </summary>
        private const int low_High= 127;
        private const int low_High = 127;
        /// <summary>
        /// 功能
        /// </summary>
@@ -34,10 +34,14 @@
        /// 场景
        /// </summary>
        private ButtonLineForm sceneBtn;
        ///// <summary>
        ///// 自动化
        ///// </summary>
        //private ButtonLineForm automationBtn;
        /// <summary>
        /// 自动化
        /// </summary>
        private ButtonLineForm automationBtn;
        public  static  ButtonLineForm automationBtn;
        /// <summary>
        /// 场景功能中部背景bodyView
        /// </summary>
@@ -106,7 +110,7 @@
        /// <summary>
        /// 相同类型的设备列表
        /// </summary>
        private Dictionary<int, List<DeviceUI>> typeDeviceDic;
        private Dictionary<int, List<CommonDevice>> typeDeviceDic;
        /// <summary>
        /// 设备类型的图id
        /// </summary>
@@ -114,42 +118,15 @@
        /// <summary>
        /// dList
        /// </summary>
        private List<DeviceUI> devList;
        private List<CommonDevice> devList;
        /// <summary>
        /// sceneList
        /// </summary>
        private List<SceneUI> sceneList;
        /// <summary>
        /// 当前选中房间
        /// </summary>
        private Common.Room curRoom;
        #endregion
        #region ◆ 接口____________________________
        /// <summary>
        /// 该接口将弃用 改用DeviceInfoChange()
        /// </summary>
        /// <param name="common">Common.</param>
        public void Changed(CommonDevice common)
        {
        }
        /// <summary>
        /// Changeds the IL ogic status.
        /// </summary>
        /// <param name="logic">Logic.</param>
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
        }
        /// <summary>
        /// Changeds the IS cene status.
        /// </summary>
        /// <param name="scene">Scene.</param>
        public void ChangedISceneStatus(Scene scene)
        {
        }
        /// <summary>
        /// 设备状态更新接口
        /// <para>type:如果为 DeviceInComingRespon:设备新上报</para>
@@ -176,33 +153,33 @@
                        for (int i = 0; deviceListScrolView != null && i < deviceListScrolView.ChildrenCount; i++)
                        {
                            var rowLayout = deviceListScrolView.GetChildren(i) as RowLayout;
                            var deviceUI = rowLayout.Tag as DeviceUI;
                            if (deviceUI == null || deviceUI.CommonDevice == null)
                            var deviceUI = LocalDevice.Current.GetDevice(rowLayout.Tag.ToString());
                            if (deviceUI == null)
                            {
                                continue;
                            }
                            if (deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr || deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint)
                            if (deviceUI.DeviceAddr != common.DeviceAddr || deviceUI.DeviceEpoint != common.DeviceEpoint)
                            {
                                continue;
                            }
                            switch (deviceUI.CommonDevice.Type)
                            switch (deviceUI.Type)
                            {
                                case DeviceType.OnOffOutput:
                                    //开关功能
                                    if (common.DeviceStatusReport.CluterID == 6)
                                    {
                                        var light = deviceUI.CommonDevice as ToggleLight;
                                        var light = deviceUI as ToggleLight;
                                        light.DeviceStatusReport = common.DeviceStatusReport;
                                        light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData;
                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                        row.IsSelected = light.OnOffStatus == 1;
                                        row.SetStatuText(deviceUI.GetDeviceStatu());
                                        row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        light.LastDateTime = DateTime.Now;
                                    }
                                    if (common.DeviceStatusReport.CluterID == 3)
                                    {
                                        deviceUI.CommonDevice.IsOnline = 1;
                                        deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                        deviceUI.IsOnline = 1;
                                        deviceUI.LastDateTime = DateTime.Now;
                                    }
                                    break;
@@ -210,18 +187,18 @@
                                    //开关功能
                                    if (common.DeviceStatusReport.CluterID == 6)
                                    {
                                        var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
                                        var airSwitch = deviceUI as ZigBee.Device.AirSwitch;
                                        airSwitch.DeviceStatusReport = common.DeviceStatusReport;
                                        airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                        row.IsSelected = airSwitch.OnOffStatus == 1;
                                        row.SetStatuText(deviceUI.GetDeviceStatu());
                                        row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        airSwitch.LastDateTime = DateTime.Now;
                                    }
                                    if (common.DeviceStatusReport.CluterID == 3)
                                    {
                                        deviceUI.CommonDevice.IsOnline = 1;
                                        deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                        deviceUI.IsOnline = 1;
                                        deviceUI.LastDateTime = DateTime.Now;
                                    }
                                    break;
                                case DeviceType.WindowCoveringDevice:
@@ -231,7 +208,7 @@
                                        if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0)
                                        {
                                            //窗帘类型
                                            var rollerShade = deviceUI.CommonDevice as Rollershade;
                                            var rollerShade = deviceUI as Rollershade;
                                            rollerShade.DeviceStatusReport = common.DeviceStatusReport;
                                            rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData;
                                            rollerShade.LastDateTime = DateTime.Now;
@@ -240,18 +217,18 @@
                                        {
                                            var row = rowLayout.GetChildren(0) as CategoryFunctionForWinRow;
                                            //窗帘百分比
                                            var rollerShade = deviceUI.CommonDevice as Rollershade;
                                            var rollerShade = deviceUI as Rollershade;
                                            rollerShade.DeviceStatusReport = common.DeviceStatusReport;
                                            rollerShade.WcdCurrentPositionLiftPercentage = common.DeviceStatusReport.AttriBute[0].AttriButeData;
                                            row.SetStatuText($"{Language.StringByID(R.MyInternationalizationString.Current)} { deviceUI.GetDeviceStatu()}");
                                            row.SetStatuText($"{Language.StringByID(R.MyInternationalizationString.Current)} { HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI)}");
                                            row.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0;
                                            rollerShade.LastDateTime = DateTime.Now;
                                        }
                                    }
                                    if (common.DeviceStatusReport.CluterID == 3)
                                    {
                                        deviceUI.CommonDevice.IsOnline = 1;
                                        deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                        deviceUI.IsOnline = 1;
                                        deviceUI.LastDateTime = DateTime.Now;
                                    }
                                    break;
@@ -260,9 +237,9 @@
                                    if (common.DeviceStatusReport.CluterID == 513)
                                    {
                                        var attriButeList = common.DeviceStatusReport.AttriBute;
                                        var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                        var ac = deviceUI as ZigBee.Device.AC;
                                        ac.DeviceStatusReport = common.DeviceStatusReport;
                                        foreach(var attList in attriButeList)
                                        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)
@@ -287,14 +264,6 @@
                                                    ac.currentSystemMode = attList.AttriButeData;
                                                    ac.LastDateTime = DateTime.Now;
                                                    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;
                                                case 4097:
                                                    //过虑网清洗标志:42
                                                    ac.CleanStatu = attList.AttriButeData == 42;
@@ -303,15 +272,15 @@
                                        }
                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                        row.IsSelected = ac.currentSystemMode != 0;
                                        row.SetStatuText(deviceUI.GetDeviceStatu());
                                        row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    }
                                    if (common.DeviceStatusReport.CluterID == 514)
                                    {
                                        var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                        var ac = deviceUI as ZigBee.Device.AC;
                                        var attriButeList = common.DeviceStatusReport.AttriBute;
                                        ac.DeviceStatusReport = common.DeviceStatusReport;
                                        foreach(var attList in attriButeList)
                                        foreach (var attList in attriButeList)
                                        {
                                            switch (attList.AttributeId)
                                            {
@@ -327,12 +296,12 @@
                                        }
                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                        row.IsSelected = ac.currentSystemMode != 0;
                                        row.SetStatuText(deviceUI.GetDeviceStatu());
                                        row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    }
                                    if (common.DeviceStatusReport.CluterID == 3)
                                    {
                                        var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                        var ac = deviceUI as ZigBee.Device.AC;
                                        ac.IsOnline = 1;
                                        ac.LastDateTime = DateTime.Now;
                                    }
@@ -341,28 +310,88 @@
                                    //调光灯功能
                                    if (common.DeviceStatusReport.CluterID == 6)
                                    {
                                        var dimmableLight = deviceUI.CommonDevice as DimmableLight;
                                        var dimmableLight = deviceUI as DimmableLight;
                                        dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                        dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                        row.IsSelected = dimmableLight.OnOffStatus == 1;
                                        row.SetStatuText(deviceUI.GetDeviceStatu());
                                        row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        dimmableLight.LastDateTime = DateTime.Now;
                                    }
                                    if (common.DeviceStatusReport.CluterID == 8)
                                    {
                                        var dimmableLight = deviceUI.CommonDevice as DimmableLight;
                                        var dimmableLight = deviceUI as DimmableLight;
                                        dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                        dimmableLight.Level = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                        row.IsSelected = dimmableLight.OnOffStatus == 1;
                                        row.SetStatuText(deviceUI.GetDeviceStatu());
                                        row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        dimmableLight.LastDateTime = DateTime.Now;
                                    }
                                    if (common.DeviceStatusReport.CluterID == 3)
                                    {
                                        deviceUI.CommonDevice.IsOnline = 1;
                                        deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                        deviceUI.IsOnline = 1;
                                        deviceUI.LastDateTime = DateTime.Now;
                                    }
                                    break;
                                case DeviceType.TemperatureSensor:
                                    //温度
                                    if (common.DeviceStatusReport.CluterID == 1026)
                                    {
                                        var tempera = deviceUI as TemperatureSensor;
                                        foreach (var data in common.DeviceStatusReport.AttriBute)
                                        {
                                            if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
                                            {
                                                if (data.AttriButeData == 0)
                                                {
                                                    tempera.Temperatrue = 0;
                                                }
                                                else if (data.AttriButeData > 32767)
                                                {
                                                    //负数(特殊处理)
                                                    string strValue = (data.AttriButeData - 65536).ToString();
                                                    //小数点需要一位
                                                    strValue = strValue.Substring(0, strValue.Length - 1);
                                                    tempera.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
                                                }
                                                else
                                                {
                                                    //小数点需要一位
                                                    string strValue = data.AttriButeData.ToString();
                                                    strValue = strValue.Substring(0, strValue.Length - 1);
                                                    tempera.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
                                                }
                                                var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                                row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                            }
                                        }
                                    }
                                    //湿度
                                    if (common.DeviceStatusReport.CluterID == 1029)
                                    {
                                        var tempera = deviceUI as TemperatureSensor;
                                        foreach (var data in common.DeviceStatusReport.AttriBute)
                                        {
                                            if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
                                            {
                                                if (data.AttriButeData == 0)
                                                {
                                                    tempera.Humidity = 0;
                                                }
                                                else
                                                {
                                                    //小数点需要一位(湿度没有负数)
                                                    string strValue = data.AttriButeData.ToString();
                                                    strValue = strValue.Substring(0, strValue.Length - 1);
                                                    tempera.Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
                                                    tempera.LastDateTime = DateTime.Now;
                                                }
                                                var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                                row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                            }
                                        }
                                    }
                                    break;
                            }
@@ -383,40 +412,40 @@
                        for (int i = 0; deviceListScrolView != null && i < deviceListScrolView.ChildrenCount; i++)
                        {
                            var rowLayout = deviceListScrolView.GetChildren(i) as RowLayout;
                            var deviceUI = rowLayout.Tag as DeviceUI;
                            if (deviceUI == null || deviceUI.CommonDevice == null)
                            var deviceUI = LocalDevice.Current.GetDevice(rowLayout.Tag.ToString());
                            if (deviceUI == null)
                            {
                                continue;
                            }
                            if (deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr || deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint)
                            if (deviceUI.DeviceAddr != common.DeviceAddr || deviceUI.DeviceEpoint != common.DeviceEpoint)
                            {
                                continue;
                            }
                            switch (deviceUI.CommonDevice.Type)
                            switch (deviceUI.Type)
                            {
                                case DeviceType.OnOffOutput:
                                    deviceUI.CommonDevice.IsOnline = common.IsOnline;
                                    deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                    deviceUI.IsOnline = common.IsOnline;
                                    deviceUI.LastDateTime = DateTime.Now;
                                    break;
                                case DeviceType.AirSwitch:
                                    deviceUI.CommonDevice.IsOnline = common.IsOnline;
                                    deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                    deviceUI.IsOnline = common.IsOnline;
                                    deviceUI.LastDateTime = DateTime.Now;
                                    break;
                                case DeviceType.WindowCoveringDevice:
                                    deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                    deviceUI.CommonDevice.IsOnline = common.IsOnline;
                                    deviceUI.LastDateTime = DateTime.Now;
                                    deviceUI.IsOnline = common.IsOnline;
                                    break;
                                case DeviceType.DimmableLight:
                                    deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                    deviceUI.CommonDevice.IsOnline = common.IsOnline;
                                    deviceUI.LastDateTime = DateTime.Now;
                                    deviceUI.IsOnline = common.IsOnline;
                                    break;
                                case DeviceType.Thermostat:
                                    deviceUI.CommonDevice.LastDateTime = DateTime.Now;
                                    deviceUI.CommonDevice.IsOnline = common.IsOnline;
                                    deviceUI.LastDateTime = DateTime.Now;
                                    deviceUI.IsOnline = common.IsOnline;
                                    break;
                            }
                        }
@@ -436,25 +465,25 @@
                        for (int i = 0; deviceListScrolView != null && i < deviceListScrolView.ChildrenCount; i++)
                        {
                            var rowLayout = deviceListScrolView.GetChildren(i) as RowLayout;
                            var deviceUI = rowLayout.Tag as DeviceUI;
                            if (deviceUI == null || deviceUI.CommonDevice == null)
                            var deviceUI = LocalDevice.Current.GetDevice(rowLayout.Tag.ToString());
                            if (deviceUI == null)
                            {
                                continue;
                            }
                            if (deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr || deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint)
                            if (deviceUI.DeviceAddr != common.DeviceAddr || deviceUI.DeviceEpoint != common.DeviceEpoint)
                            {
                                continue;
                            }
                            switch (deviceUI.CommonDevice.Type)
                            switch (deviceUI.Type)
                            {
                                case DeviceType.IASZone:
                                    //开关功能
                                    var ias = common as IASZone;
                                    var iAS = deviceUI.CommonDevice as ZigBee.Device.IASZone;
                                    var iAS = deviceUI as ZigBee.Device.IASZone;
                                    iAS.iASInfo = ias.iASInfo;
                                    var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
                                    row.IsSelected = iAS.iASInfo?.Alarm1 == 1;
                                    row.SetStatuText(deviceUI.GetDeviceStatu());
                                    row.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    iAS.LastDateTime = DateTime.Now;
                                    break;
                            }
@@ -519,7 +548,7 @@
                TextID = R.MyInternationalizationString.Category,
                TextSize = 24,
                TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor,
                IsBold=true
                IsBold = true
            };
            topView.AddChidren(title);
@@ -563,7 +592,7 @@
            functionBtn.SetTitle(R.MyInternationalizationString.Function);
            functionBtn.X = sceneBtn.Right;
            //自动化
            automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20+50, 34);
            automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20 + 50, 34);
            automationBtn.Init();
            automationBtn.SetTitle(R.MyInternationalizationString.Automation);
            automationBtn.X = functionBtn.Right;
@@ -581,8 +610,8 @@
                Gravity = Gravity.CenterVertical,
                TextAlignment = TextAlignment.CenterRight,
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextSize=14,
                IsBold=true
                TextSize = 14,
                IsBold = true
            };
            selectFloorBtn = new Button()
@@ -650,7 +679,7 @@
            addBtn.MouseUpEventHandler += AddBtn_MouseUpEventHandler;
            selectFloorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler;
            floorBtn.MouseUpEventHandler+= SelectedFloor_MouseUpEventHandler;
            floorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler;
        }
@@ -661,13 +690,14 @@
        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
        private void SelectedFloor_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs)
        {
            var floors = new SelectFloor ();
            var floors = new SelectFloor();
            AddChidren(floors);
            floors.Init(580,330,Direction.Right);
            floors.Init(580, 330, Direction.Right);
            floors.changeFloor = true;
            floors.FloorAction += (floorId) =>
            {
                floorBtn.Text = Config.Instance.Home.GetFloorNameById(floorId);
                HdlRoomLogic.Current.CurrentRoom = HdlRoomLogic.Current.GetLoveRoom();
                RefreshBodyView();
            };
        }
@@ -751,6 +781,10 @@
            UserView.HomePage.Instance.AddChidren(scene);
            UserView.HomePage.Instance.PageIndex += 1;
            scene.Show();
            scene.AddAction = () =>
            {
                ShowScene();
            };
        }
        /// <summary>
@@ -808,7 +842,7 @@
        /// </summary>
        private void InitData()
        {
            typeDeviceDic = new Dictionary<int, List<DeviceUI>> { };
            typeDeviceDic = new Dictionary<int, List<CommonDevice>> { };
            typeIdDic = new Dictionary<int, DeviceConcreteType> { };
        }
@@ -817,20 +851,20 @@
        /// </summary>
        private void RefreshData(Common.Room room)
        {
            devList = room.DeviceUIList;
            sceneList = room.SceneUIList;
            devList = HdlRoomLogic.Current.GetRoomListDevice(room);
            sceneList = HdlSceneLogic.Current.GetRoomSceneList(room);
            typeDeviceDic.Clear();
            typeIdDic.Clear();
            foreach (var device in devList)
            {
                var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice);
                var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device);
                if (info.BeloneType == DeviceBeloneType.A干接点 || info.BeloneType == DeviceBeloneType.A中继器)
                {
                    continue;
                }
                if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false)
                {
                    var sameDevList = new List<DeviceUI> { };
                    var sameDevList = new List<CommonDevice> { };
                    sameDevList.Add(device);
                    typeDeviceDic[info.BeloneTextId] = sameDevList;
                }
@@ -860,10 +894,10 @@
        {
            var noFunction = new Button()
            {
                Y=Application.GetRealHeight(320),
                Width=Application.GetMinRealAverage(757),
                Y = Application.GetRealHeight(320),
                Width = Application.GetMinRealAverage(757),
                Height = Application.GetMinRealAverage(435),
                UnSelectedImagePath="Item/NoFunction.png",
                UnSelectedImagePath = "Item/NoFunction.png",
                Gravity = Gravity.CenterHorizontal
            };
            functionSceneBodyView.AddChidren(noFunction);
@@ -874,10 +908,10 @@
                Height = Application.GetRealHeight(200),
                Width = Application.GetRealWidth(700),
                Gravity = Gravity.CenterHorizontal,
                Text = Language.StringByID(R.MyInternationalizationString.NoFunction).Replace("{\\r\\n}","\r\n"),
                Text = Language.StringByID(R.MyInternationalizationString.NoFunction).Replace("{\\r\\n}", "\r\n"),
                TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
                TextAlignment = TextAlignment.Center,
                IsMoreLines=true
                IsMoreLines = true
            };
            functionSceneBodyView.AddChidren(noFunctionTip);
        }
@@ -931,7 +965,7 @@
                deviceListScrolView = new VerticalScrolViewLayout
                {
                    X = Application.GetRealWidth(CommonFormResouce.X_Left),
                    Y = Application.GetRealHeight(35+279),
                    Y = Application.GetRealHeight(35 + 279),
                    Width = Application.GetRealWidth(1028),
                    Height = Application.GetRealHeight(942),
                    BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
@@ -940,7 +974,7 @@
                deviceListScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
                tempFunctionTypeBtn = new FunctionButton();
                tempFunctionTypeBtn.Init("","");
                tempFunctionTypeBtn.Init("", "");
                foreach (var deviceType in typeIdDic)
                {
@@ -984,7 +1018,7 @@
            deviceListScrolView.RemoveAll();
            var sameTypeList = new List<DeviceUI> { };
            var sameTypeList = new List<CommonDevice> { };
            sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())];
            for (int i = 0; i < sameTypeList.Count; i++)
@@ -996,48 +1030,19 @@
                    {
                        try
                        {
                            //删除设备
                            EventHandler<MouseEventArgs> delEvent = (delSender, delE) =>
                            var deviceTypeRowLayout = new RowLayout()
                            {
                                var alert = new CustomAlert();
                                AddChidren(alert);
                                alert.Show(Language.StringByID(R.MyInternationalizationString.DeleteFunction));
                                alert.ResultEventHandler += (e2) =>
                                {
                                    if (e2)
                                    {
                                        if(curRoom.IsLove)
                                        {
                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName);
                                            deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
                                            sameTypeList.Remove(deviceUI);
                                        }
                                        else
                                        {
                                            Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.CommonDevice);
                                            deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
                                            sameTypeList.Remove(deviceUI);
                                        }
                                        //if (sameTypeList.Count == 0)
                                        //{
                                        //    RefreshBodyView();
                                        //}
                                    }
                                };
                                Height = Application.GetRealHeight(127 + 35),
                                LineColor = ZigbeeColor.Current.GXCClearColor,
                                Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI),
                                SubViewWidth = Application.GetRealWidth(184)
                            };
                            EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                            {
                                var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                UserView.HomePage.Instance.AddChidren(detailInfo);
                                UserView.HomePage.Instance.PageIndex += 1;
                                detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom);
                                detailInfo.action = RefreshBodyView;
                            };
                            deviceListScrolView.AddChidren(deviceTypeRowLayout);
                            if (deviceUI.CommonDevice.Type == DeviceType.OnOffOutput)
                            if (deviceUI.Type == DeviceType.OnOffOutput)
                            {
                                //灯
                                var light = deviceUI.CommonDevice as ToggleLight;
                                var light = deviceUI as ToggleLight;
                                if (light.Gateway != null)
                                {
                                    new System.Threading.Thread(() =>
@@ -1047,7 +1052,7 @@
                                        {
                                            UserHomeView.ReadStatus(light, () =>
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI);
                                            });
                                        }
                                        else
@@ -1055,34 +1060,25 @@
                                            //防止短时间内多次读取状态
                                            if (CommonPage.ReadDeviceStatuSpan < (DateTime.Now - light.LastDateTime).TotalSeconds)
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI);
                                            }
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                    var deviceTypeRowLayout = new RowLayout()
                                    {
                                        Height = Application.GetRealHeight(129 + 35),
                                        LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                        Tag = deviceUI
                                    };
                                    deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                    var deviceRow = new CategoryFunctionRow(0, 35);
                                    deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                    //deviceRow.SetOnLineStatu(light.IsOnline == 1);
                                    deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                    deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    deviceRow.IsSelected = light.OnOffStatus == 1;
                                    deviceTypeRowLayout.AddChidren(deviceRow);
                                    deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        zbGateway = deviceUI.CommonDevice.Gateway;
                                        zbGateway = deviceUI.Gateway;
                                        sendedControlCommand = false;
                                        zbGateway.ReportAction += UpdateDeviceControllStatu;
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI);
                                        (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
                                        if ((send2 as Button).IsSelected)
@@ -1093,9 +1089,9 @@
                                        {
                                            light.SwitchControl(0);
                                        }
                                        deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                        deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        //控制延时回调
                                        DeviceUI.SendCommandDelayAction(deviceUI.CommonDevice, () =>
                                        HdlDeviceOtherLogic.Current.SendCommandDelayAction(deviceUI, () =>
                                        {
                                            if (Parent == null)
                                            {
@@ -1104,62 +1100,48 @@
                                            RemoveUpdateControlDeviceStatuAction(zbGateway);
                                            if (sendedControlCommand == false)
                                            {
                                                DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                                HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                            }
                                        });
                                    };
                                    deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A开关)
                                        var lightControl = new Phone.Device.Light.OnOffControl();
                                        UserView.HomePage.Instance.AddChidren(lightControl);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        lightControl.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        lightControl.action += (curDev, curRoom) =>
                                        {
                                            var lightControl = new Phone.Device.Light.OnOffControl();
                                            UserView.HomePage.Instance.AddChidren(lightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            //lightControl.action = RefreshBodyView;
                                            lightControl.Show(deviceUI, curRoom);
                                        }
                                        else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A插座)
                                        {
                                            var lightControl = new Phone.Device.Light.PlugControl();
                                            UserView.HomePage.Instance.AddChidren(lightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            //lightControl.action = RefreshBodyView;
                                            lightControl.Show(deviceUI, curRoom);
                                        }
                                        else
                                        {
                                            var lightControl = new Phone.Device.Light.LightControl();
                                            UserView.HomePage.Instance.AddChidren(lightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            //lightControl.action = RefreshBodyView;
                                            lightControl.Show(deviceUI, curRoom);
                                        }
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                    {
                                        var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                        UserView.HomePage.Instance.AddChidren(detailInfo);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        detailInfo.EditAction += (curDevice, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                        Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                    };
                                    var delBtn = new CommonForm.RowLayoutDeleteButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    if (curRoom.IsSharedRoom == false)
                                    if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                        deviceTypeRowLayout.AddRightView(delBtn);
                                        delBtn.MouseUpEventHandler += delEvent;
                                    }
                                }
                            }
                            else if (deviceUI.CommonDevice.Type == DeviceType.AirSwitch)
                            else if (deviceUI.Type == DeviceType.AirSwitch)
                            {
                                //空气开关
                                var airSwitch = deviceUI.CommonDevice as AirSwitch;
                                var airSwitch = deviceUI as AirSwitch;
                                if (airSwitch.Gateway != null)
                                {
                                    new System.Threading.Thread(() =>
@@ -1169,41 +1151,31 @@
                                        {
                                            UserHomeView.ReadStatus(airSwitch, () =>
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI);
                                            });
                                        }
                                        else
                                        {
                                            if ((DateTime.Now - airSwitch.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI);
                                            }
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                    var deviceTypeRowLayout = new RowLayout()
                                    {
                                        Height = Application.GetRealHeight(129 + 35),
                                        LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                        Tag = deviceUI
                                    };
                                    deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                    var deviceRow = new CategoryFunctionRow(0, 35);
                                    deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                    //deviceRow.SetOnLineStatu(airSwitch.IsOnline == 1);
                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                    deviceRow.IsSelected = airSwitch.OnOffStatus == 1;
                                    deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                    deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    deviceTypeRowLayout.AddChidren(deviceRow);
                                    deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        zbGateway = deviceUI.CommonDevice.Gateway;
                                        zbGateway = deviceUI.Gateway;
                                        sendedControlCommand = false;
                                        zbGateway.ReportAction += UpdateDeviceControllStatu;
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI);
                                        (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
                                        if ((send2 as Button).IsSelected)
@@ -1214,9 +1186,9 @@
                                        {
                                            airSwitch.SwitchControl(0);
                                        }
                                        deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                        deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        //控制延时回调
                                        DeviceUI.SendCommandDelayAction(deviceUI.CommonDevice, () =>
                                        HdlDeviceOtherLogic.Current.SendCommandDelayAction(deviceUI, () =>
                                        {
                                            if (Parent == null)
                                            {
@@ -1225,44 +1197,52 @@
                                            RemoveUpdateControlDeviceStatuAction(zbGateway);
                                            if (sendedControlCommand == false)
                                            {
                                                DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                                HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                            }
                                        });
                                    };
                                    deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        var lightControl = new Phone.Device.Light.AirSwitchControl();
                                        UserView.HomePage.Instance.AddChidren(lightControl);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        //lightControl.action = RefreshBodyView;
                                        lightControl.Show(deviceUI, curRoom);
                                        lightControl.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        lightControl.action += (curDev, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                    {
                                        var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                        UserView.HomePage.Instance.AddChidren(detailInfo);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        detailInfo.EditAction += (curDevice, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                        Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                    };
                                    var delBtn = new CommonForm.RowLayoutDeleteButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    if (curRoom.IsSharedRoom == false)
                                    if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                        deviceTypeRowLayout.AddRightView(delBtn);
                                        delBtn.MouseUpEventHandler += delEvent;
                                    }
                                }
                            }
                            else if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight)
                            else if (deviceUI.Type == DeviceType.DimmableLight)
                            {
                                //调光灯
                                var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
                                var dimmableLight = deviceUI as ZigBee.Device.DimmableLight;
                                if (dimmableLight.Gateway != null)
                                {
                                    new System.Threading.Thread(() =>
@@ -1272,41 +1252,32 @@
                                        {
                                            UserHomeView.ReadStatus(dimmableLight, () =>
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI);
                                            });
                                        }
                                        else
                                        {
                                            if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI);
                                            }
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                    var deviceTypeRowLayout = new RowLayout()
                                    {
                                        Height = Application.GetRealHeight(129 + 35),
                                        LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                        Tag = deviceUI
                                    };
                                    deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                    var deviceRow = new CategoryFunctionRow(0, 35);
                                    deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                    //deviceRow.SetOnLineStatu(dimmableLight.IsOnline == 1);
                                    deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                    deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    deviceRow.IsSelected = dimmableLight.OnOffStatus == 1;
                                    deviceTypeRowLayout.AddChidren(deviceRow);
                                    deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        zbGateway = deviceUI.CommonDevice.Gateway;
                                        zbGateway = deviceUI.Gateway;
                                        sendedControlCommand = false;
                                        zbGateway.ReportAction += UpdateDeviceControllStatu;
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI);
                                        (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
                                        if ((send2 as Button).IsSelected)
@@ -1317,9 +1288,9 @@
                                        {
                                            dimmableLight.SwitchControl(0);
                                        }
                                        deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                        deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        //控制延时回调
                                        DeviceUI.SendCommandDelayAction(deviceUI.CommonDevice, () =>
                                        HdlDeviceOtherLogic.Current.SendCommandDelayAction(deviceUI, () =>
                                        {
                                            if (Parent == null)
                                            {
@@ -1328,7 +1299,7 @@
                                            RemoveUpdateControlDeviceStatuAction(zbGateway);
                                            if (sendedControlCommand == false)
                                            {
                                                DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                                HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                            }
                                        });
                                    };
@@ -1339,33 +1310,40 @@
                                        UserView.HomePage.Instance.AddChidren(dimmableLightControl);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        UserView.HomePage.Instance.ScrollEnabled = false;
                                        //dimmableLightControl.action = RefreshBodyView;
                                        dimmableLightControl.Show(deviceUI, curRoom);
                                        dimmableLightControl.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        dimmableLightControl.action += (curDev, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                    {
                                        var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                        UserView.HomePage.Instance.AddChidren(detailInfo);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        detailInfo.EditAction += (curDevice, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                        Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                    };
                                    var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    if (curRoom.IsSharedRoom == false)
                                    if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                        deviceTypeRowLayout.AddRightView(delBtn);
                                        delBtn.MouseUpEventHandler += delEvent;
                                    }
                                }
                            }
                            else if (deviceUI.CommonDevice.Type == DeviceType.Thermostat)
                            else if (deviceUI.Type == DeviceType.Thermostat)
                            {
                                //空调
                                var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                var ac = deviceUI as ZigBee.Device.AC;
                                if (ac.Gateway != null)
                                {
                                    new System.Threading.Thread(() =>
@@ -1376,7 +1354,7 @@
                                            //发送读取状态命令
                                            UserView.UserHomeView.ReadStatus(ac, () =>
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI);
                                            });
                                        }
                                        else
@@ -1384,34 +1362,25 @@
                                            //防止短时间内多次读取设备状态
                                            if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI);
                                            }
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                    var deviceTypeRowLayout = new RowLayout()
                                    {
                                        Height = Application.GetRealHeight(129 + 35),
                                        LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                        Tag = deviceUI
                                    };
                                    deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                    var deviceRow = new CategoryFunctionRow(0, 35);
                                    deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                    //deviceRow.SetOnLineStatu(ac.IsOnline == 1);
                                    deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                    deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    deviceRow.IsSelected = ac.currentSystemMode != 1;
                                    deviceTypeRowLayout.AddChidren(deviceRow);
                                    deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        zbGateway = deviceUI.CommonDevice.Gateway;
                                        zbGateway = deviceUI.Gateway;
                                        sendedControlCommand = false;
                                        zbGateway.ReportAction += UpdateDeviceControllStatu;
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
                                        AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI);
                                        (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
                                        deviceRow.IsSelected = (send2 as Button).IsSelected;
@@ -1423,9 +1392,9 @@
                                        {
                                            ac.Close();
                                        }
                                        deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                        deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                        //控制延时回调
                                        DeviceUI.SendCommandDelayAction(deviceUI.CommonDevice, () =>
                                        HdlDeviceOtherLogic.Current.SendCommandDelayAction(deviceUI, () =>
                                        {
                                            if (Parent == null)
                                            {
@@ -1434,44 +1403,51 @@
                                            RemoveUpdateControlDeviceStatuAction(zbGateway);
                                            if (sendedControlCommand == false)
                                            {
                                                DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                                HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL);
                                            }
                                        });
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    var delBtn = new CommonForm.RowLayoutDeleteButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    if (curRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                        deviceTypeRowLayout.AddRightView(delBtn);
                                        delBtn.MouseUpEventHandler += delEvent;
                                    }
                                    deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        var acControl = new Phone.Device.AC.ACControl();
                                        UserView.HomePage.Instance.AddChidren(acControl);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        UserView.HomePage.Instance.ScrollEnabled = false;
                                        //rollerShadeControl.action = RefreshBodyView;
                                        acControl.Show(deviceUI, curRoom);
                                        acControl.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        acControl.action += (curDev, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                    {
                                        var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                        UserView.HomePage.Instance.AddChidren(detailInfo);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        detailInfo.EditAction += (curDevice, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                    };
                                    if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                    }
                                }
                            }
                            else if (deviceUI.CommonDevice.Type == DeviceType.WindowCoveringDevice)
                            else if (deviceUI.Type == DeviceType.WindowCoveringDevice)
                            {
                                //卷帘
                                var rollerShade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
                                var rollerShade = deviceUI as ZigBee.Device.Rollershade;
                                if (rollerShade.Gateway != null)
                                {
                                    new System.Threading.Thread(() =>
@@ -1481,7 +1457,7 @@
                                        {
                                            UserHomeView.ReadStatus(rollerShade, () =>
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI);
                                            });
                                        }
                                        else
@@ -1489,25 +1465,16 @@
                                            //防止短时间内多次读取
                                            if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                                            {
                                                ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI.CommonDevice);
                                                ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI);
                                            }
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                    var deviceTypeRowLayout = new RowLayout()
                                    {
                                        Height = Application.GetRealHeight(129 + 35),
                                        LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                        Tag = deviceUI
                                    };
                                    deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                    var deviceRow = new CategoryFunctionForWinRow(0, 35);
                                    deviceRow.Init(deviceUI);
                                    deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                    //deviceRow.SetOnLineStatu(rollerShade.IsOnline == 1);
                                    deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                    deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    deviceRow.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0;
                                    deviceRow.SetRollerShadeIcon(rollerShade.WcdType);
                                    deviceTypeRowLayout.AddChidren(deviceRow);
@@ -1529,155 +1496,339 @@
                                        { IsBackground = true }.Start();
                                    }
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                    {
                                        Tag = deviceUI,
                                        Radius = 0
                                    };
                                    if (curRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                        deviceTypeRowLayout.AddRightView(delBtn);
                                        delBtn.MouseUpEventHandler += delEvent;
                                    }
                                    deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                    {
                                        var rollerShadeControl = new Phone.Device.Curtain.RollerShadeControl();
                                        UserView.HomePage.Instance.AddChidren(rollerShadeControl);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        UserView.HomePage.Instance.ScrollEnabled = false;
                                        //rollerShadeControl.action = RefreshBodyView;
                                        rollerShadeControl.Show(deviceUI, curRoom);
                                        rollerShadeControl.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        rollerShadeControl.action += (curDev, curRoom) =>
                                        {
                                            ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                    {
                                        var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                        UserView.HomePage.Instance.AddChidren(detailInfo);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        detailInfo.EditAction += (curDevice, curRoom) =>
                                        {
                                            ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                    };
                                    if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                    }
                                }
                            }
                            else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock)
                            else if (deviceUI.Type == DeviceType.DoorLock)
                            {
                                var deviceTypeRowLayout = new RowLayout()
                                {
                                    Height = Application.GetRealHeight(129 + 35),
                                    LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                    Tag = deviceUI
                                };
                                deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                var deviceRow = new CategoryFunctionRow(0, 35);
                                deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                //deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
                                deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                deviceRow.HideSwitchBtn(true);
                                deviceTypeRowLayout.AddChidren(deviceRow);
                                deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                                {
                                    var userDoorLockPage = new UserDoorLockPage(curRoom, deviceUI);
                                    var userDoorLockPage = new UserDoorLockPage(HdlRoomLogic.Current.CurrentRoom, deviceUI);
                                    HomePage.Instance.AddChidren(userDoorLockPage);
                                    HomePage.Instance.PageIndex += 1;
                                    userDoorLockPage.Show();
                                };
                                EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                {
                                    var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                    UserView.HomePage.Instance.AddChidren(detailInfo);
                                    UserView.HomePage.Instance.PageIndex += 1;
                                    detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                    detailInfo.EditAction += (curDevice, curRoom) =>
                                    {
                                        ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                    };
                                };
                                var editBtn = new CommonForm.RowLayoutEditButton()
                                {
                                    Tag = deviceUI
                                    Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                };
                                var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                {
                                    Tag = deviceUI
                                };
                                if (curRoom.IsSharedRoom == false)
                                if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                {
                                    deviceTypeRowLayout.AddRightView(editBtn);
                                    editBtn.MouseUpEventHandler += deviceDetailHandler;
                                    deviceTypeRowLayout.AddRightView(delBtn);
                                    delBtn.MouseUpEventHandler += delEvent;
                                }
                            }
                            else if (deviceUI.CommonDevice.Type == DeviceType.IASZone)
                            else if (deviceUI.Type == DeviceType.IASZone)
                            {
                                var deviceTypeRowLayout = new RowLayout()
                                {
                                    Height = Application.GetRealHeight(129 + 35),
                                    LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                    Tag = deviceUI
                                };
                                deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                var deviceRow = new CategoryFunctionRow(0, 35);
                                deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                deviceRow.IsSelected = (deviceUI.CommonDevice as IASZone).iASInfo?.Alarm1 == 1;
                                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                deviceRow.IsSelected = (deviceUI as IASZone).iASInfo?.Alarm1 == 1;
                                deviceRow.HideSwitchBtn(true);
                                deviceTypeRowLayout.AddChidren(deviceRow);
                                EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                {
                                    var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                    UserView.HomePage.Instance.AddChidren(detailInfo);
                                    UserView.HomePage.Instance.PageIndex += 1;
                                    detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                    detailInfo.EditAction += (curDevice, curRoom) =>
                                    {
                                        ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                    };
                                };
                                var editBtn = new CommonForm.RowLayoutEditButton()
                                {
                                    Tag = deviceUI
                                    Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                };
                                var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                {
                                    Tag = deviceUI
                                };
                                if (curRoom.IsSharedRoom == false)
                                if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                {
                                    deviceTypeRowLayout.AddRightView(editBtn);
                                    editBtn.MouseUpEventHandler += deviceDetailHandler;
                                    deviceTypeRowLayout.AddRightView(delBtn);
                                    delBtn.MouseUpEventHandler += delEvent;
                                }
                            }
                            else if (deviceUI.Type == DeviceType.TemperatureSensor)
                            {
                                var tempera = deviceUI as TemperatureSensor;
                                if (tempera.Gateway != null)
                                {
                                    new System.Threading.Thread(() =>
                                    {
                                        System.Threading.Thread.Sleep(100 * i);
                                        if (tempera.Gateway.IsVirtual)
                                        {
                                            UserHomeView.ReadStatus(tempera, () =>
                                            {
                                                if (tempera.SensorDiv == 1)
                                                {
                                                    ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(deviceUI);
                                                }
                                                else if (tempera.SensorDiv == 2)
                                                {
                                                    ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(deviceUI);
                                                }
                                            });
                                        }
                                        else
                                        {
                                            if (CommonPage.ReadDeviceStatuSpan < (DateTime.Now - tempera.LastDateTime).TotalSeconds)
                                            {
                                                if (tempera.SensorDiv == 1)
                                                {
                                                    ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(deviceUI);
                                                }
                                                else if (tempera.SensorDiv == 2)
                                                {
                                                    ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(deviceUI);
                                                }
                                            }
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                    var deviceRow = new CategoryFunctionRow(0, 35);
                                    deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                    deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                    deviceRow.IsSelected = false;
                                    deviceRow.HideSwitchBtn(true);
                                    deviceTypeRowLayout.AddChidren(deviceRow);
                                    EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                    {
                                        var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                        UserView.HomePage.Instance.AddChidren(detailInfo);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                        detailInfo.EditAction += (curDevice, curRoom) =>
                                        {
                                            ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                        };
                                    };
                                    var editBtn = new CommonForm.RowLayoutEditButton()
                                    {
                                        Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                    };
                                    if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                    {
                                        deviceTypeRowLayout.AddRightView(editBtn);
                                        editBtn.MouseUpEventHandler += deviceDetailHandler;
                                    }
                                }
                            }
                            else
                            {
                                var deviceTypeRowLayout = new RowLayout()
                                {
                                    Height = Application.GetRealHeight(129 + 35),
                                    LineColor = ZigbeeColor.Current.GXCBackgroundColor,
                                    Tag = deviceUI
                                };
                                deviceListScrolView.AddChidren(deviceTypeRowLayout);
                                var deviceRow = new CategoryFunctionRow(0, 35);
                                deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
                                deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
                                //deviceRow.SetOnLineStatu(deviceUI.CommonDevice.IsOnline == 1);
                                deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                                deviceRow.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI));
                                deviceRow.HideSwitchBtn(true);
                                deviceTypeRowLayout.AddChidren(deviceRow);
                                EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
                                {
                                    var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
                                    UserView.HomePage.Instance.AddChidren(detailInfo);
                                    UserView.HomePage.Instance.PageIndex += 1;
                                    detailInfo.Show(deviceUI, HdlRoomLogic.Current.CurrentRoom);
                                    detailInfo.EditAction += (curDevice, curRoom) =>
                                    {
                                        ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
                                    };
                                };
                                var editBtn = new CommonForm.RowLayoutEditButton()
                                {
                                    Tag = deviceUI
                                    Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                                };
                                var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                {
                                    Tag = deviceUI
                                };
                                if (curRoom.IsSharedRoom == false)
                                if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                                {
                                    deviceTypeRowLayout.AddRightView(editBtn);
                                    editBtn.MouseUpEventHandler += deviceDetailHandler;
                                    deviceTypeRowLayout.AddRightView(delBtn);
                                    delBtn.MouseUpEventHandler += delEvent;
                                }
                            }
                        }
                        catch
                        {
                            //删除设备
                            EventHandler<MouseEventArgs> delEvent = (delSender, delE) =>
                            {
                                var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.DeleteFunction));
                                alert.Show();
                                alert.ConfirmClickEvent += () =>
                                {
                                    if (HdlRoomLogic.Current.CurrentRoom.IsLove)
                                    {
                                        HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);
                                        deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
                                        sameTypeList.Remove(deviceUI);
                                    }
                                    else
                                    {
                                        HdlRoomLogic.Current.DeleteDevice(deviceUI);
                                        deviceListScrolView.RemoveViewByTag((delSender as Button).Tag);
                                        sameTypeList.Remove(deviceUI);
                                        HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);
                                    }
                                    if (sameTypeList.Count == 0)
                                    {
                                        RefreshBodyView();
                                    }
                                };
                            };
                            var delBtn = new CommonForm.RowLayoutDeleteButton()
                            {
                                Tag = LocalDevice.Current.GetDeviceMainKeys(deviceUI)
                            };
                            if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
                            {
                                deviceTypeRowLayout.AddRightView(delBtn);
                                delBtn.MouseUpEventHandler += delEvent;
                            }
                        }
                        catch { }
                    });
                })
                { IsBackground = true }.Start();
            }
        }
        /// <summary>
        /// ReFreshDeviceAction
        /// </summary>
        /// <param name="curRoom"></param>
        /// <param name="sameTypeList"></param>
        /// <param name="devListScrolView"></param>
        /// <param name="deviceRow"></param>
        private void ReFreshDeviceAction(CommonDevice deviceUI, Common.Room curRoom, List<CommonDevice> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionRow deviceRow)
        {
            if (HdlRoomLogic.Current.CurrentRoom.IsLove)
            {
                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                if (HdlRoomLogic.Current.IsCollectInRoom(deviceUI) == false)
                {
                    devListScrolView.RemoveViewByTag(deviceUI);
                    sameTypeList.Remove(deviceUI);
                    if (sameTypeList.Count == 0)
                    {
                        RefreshFunction(HdlRoomLogic.Current.CurrentRoom);
                    }
                }
            }
            else
            {
                if (curRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
                {
                    HdlRoomLogic.Current.DeleteDevice(deviceUI);
                    devListScrolView.RemoveViewByTag(deviceUI);
                    sameTypeList.Remove(deviceUI);
                    if (sameTypeList.Count == 0)
                    {
                        RefreshFunction(HdlRoomLogic.Current.CurrentRoom);
                    }
                }
                else
                {
                    deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                }
            }
        }
        /// <summary>
        /// ReFreshDeviceAction
        /// </summary>
        /// <param name="curRoom"></param>
        /// <param name="sameTypeList"></param>
        /// <param name="devListScrolView"></param>
        /// <param name="deviceRow"></param>
        private void ReFreshDeviceActionForWin(CommonDevice deviceUI, Common.Room curRoom, List<CommonDevice> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionForWinRow deviceRow)
        {
            if (HdlRoomLogic.Current.CurrentRoom.IsLove)
            {
                deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
                deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                if (HdlRoomLogic.Current.IsCollectInRoom(deviceUI) == false)
                {
                    devListScrolView.RemoveViewByTag(deviceUI);
                    sameTypeList.Remove(deviceUI);
                    if (sameTypeList.Count == 0)
                    {
                        RefreshFunction(HdlRoomLogic.Current.CurrentRoom);
                    }
                }
            }
            else
            {
                if (curRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
                {
                    HdlRoomLogic.Current.DeleteDevice(deviceUI);
                    devListScrolView.RemoveViewByTag(deviceUI);
                    sameTypeList.Remove(deviceUI);
                    if (sameTypeList.Count == 0)
                    {
                        RefreshFunction(HdlRoomLogic.Current.CurrentRoom);
                    }
                }
                else
                {
                    deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath);
                    deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI));
                }
            }
        }
        /// <summary>
        /// AddRoomView
@@ -1697,13 +1848,14 @@
            functionSceneBodyView = new FrameLayout()
            {
                Y = roomFL.Bottom,
                Height = Application.GetRealHeight(973+279),
                Height = Application.GetRealHeight(973 + 279),
                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
            };
            functionSceneAutoBodyView.AddChidren(functionSceneBodyView);
            RoomButton curBtn = new RoomButton(0,0);
            foreach (var room in Common.Room.CurrentRoom.GetRoomsByCurrentFloorIdAppendLoveRoom())
            RoomButton curBtn = new RoomButton(0, 0);
            var lisrRoom = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom();
            foreach (var room in lisrRoom)
            {
                var row = new FrameLayout()
                {
@@ -1718,12 +1870,11 @@
                roomBtn.SetTitle(room.Name);
                row.AddChidren(roomBtn);
                if (room.IsLove)
                if (room.Id == HdlRoomLogic.Current.CurrentRoom.Id)
                {
                    roomBtn.IsSelected = true;
                    this.curRoom = room;
                    curBtn = roomBtn;
                    if(sceneBtn.IsSelected)
                    if (sceneBtn.IsSelected)
                    {
                        RefreshScene(room);
                    }
@@ -1732,16 +1883,17 @@
                        RefreshFunction(room);
                    }
                }
                roomBtn.ButtonClickEvent += (sender, e) =>
                {
                    if (sender  == curBtn)
                    if (sender == curBtn)
                    {
                        return;
                    }
                    sender.IsSelected = true;
                    curBtn.IsSelected = false;
                    curBtn = sender;
                    this.curRoom = room;
                    HdlRoomLogic.Current.CurrentRoom = room;
                    if (sceneBtn.IsSelected)
                    {
                        RefreshScene(room);
@@ -1783,11 +1935,11 @@
                functionSceneBodyView.AddChidren(sceneScrolView);
                foreach (var scene in sceneList)
                {
                    var sceneView = new SceneCategoryView(0, 0);
                    var sceneView = new SceneCategoryView();
                    sceneScrolView.AddChidren(sceneView);
                    sceneView.Init(scene, room);
                    GetDelayScene(sceneScrolView);
                }
                    sceneView.InitControl(scene, room);
                }
                GetDelayScene(sceneScrolView);
            }
        }
@@ -1812,7 +1964,7 @@
                Height = Application.GetRealHeight(200),
                Width = Application.GetRealWidth(700),
                Gravity = Gravity.CenterHorizontal,
                Text = Language.StringByID(R.MyInternationalizationString.NoScene).Replace("{\\r\\n}","\r\n"),
                Text = Language.StringByID(R.MyInternationalizationString.NoScene).Replace("{\\r\\n}", "\r\n"),
                TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
                TextAlignment = TextAlignment.Center,
                IsMoreLines = true
@@ -1842,28 +1994,37 @@
            for (int i = 0; scrolViewLayout != null && i < scrolViewLayout.ChildrenCount; i++)
            {
                var sceneView = scrolViewLayout.GetChildren(i) as SceneCategoryView;
                if (sceneView == null)
                {
                    continue;
                }
                foreach (var delayScenesListResponseInfo in delayList)
                {
                    if (delayScenesListResponseInfo.ScenesId == sceneView.scene.Id)
                    {
                        sceneView.scene.RemainTime = delayScenesListResponseInfo.RemainTime;
                        var remainTime= delayScenesListResponseInfo.RemainTime;
                        var remainTime = delayScenesListResponseInfo.RemainTime;
                        if (remainTime > 0)
                        {
                        {
                            //开启内部延时时间线程(旨在全部地方的同一场景时间同步)
                            HdlSceneLogic.Current.StartDelayTimeThread(sceneView.scene);
                            new System.Threading.Thread(() =>
                            {
                                while (remainTime-- > 0)
                                while (remainTime > 0 && this.Parent != null)
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    Application.RunOnMainThread(() =>
                                    {
                                        sceneView.SetTimeText(CommonFormResouce.GetTimeString(remainTime));
                                    });
                                    remainTime--;
                                }
                                Application.RunOnMainThread(() =>
                                {
                                    sceneView.scene.RemainTime = 0;
                                    sceneView.SetTimeImage();
                                    if (this.Parent != null)
                                    {
                                        sceneView.SetTimeImage();
                                    }
                                });
                            })
                            { IsBackground = true }.Start();
@@ -1872,31 +2033,19 @@
                    }
                }
            }
        }
        /// <summary>
        /// GetExecScene
        /// </summary>
        /// <param name="scrolViewLayout"></param>
        private void GetExecScene(VerticalScrolViewLayout scrolViewLayout)
        {
            new System.Threading.Thread(() =>
            {
            })
            { IsBackground = true }.Start();
        }
        }
        #endregion
        #region ◆ 自动化__________________________
        /// <summary>
        /// 自动化功能代码入口
        /// </summary>
        private  void ShowAutotion()
        private void ShowAutotion()
        {
           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            var bjFrameLayout = new FrameLayout
            {
                Width = Application.GetRealWidth(1080 - 58),
@@ -1905,9 +2054,11 @@
                X = Application.GetRealWidth(58),
                //Radius = (uint)Application.GetRealHeight(50),
                Y = Application.GetRealHeight(30),
            };
            functionSceneAutoBodyView.AddChidren(bjFrameLayout);
            bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft);
            //图标控件
            var sigBtn = new Button
            {
                Width = Application.GetMinRealAverage(84),
@@ -1917,7 +2068,7 @@
                Gravity = Gravity.CenterVertical,
            };
            bjFrameLayout.AddChidren(sigBtn);
            //推荐模板文本控件
            var recommendtextBtn = new Button
            {
                Width = Application.GetMinRealAverage(300),
@@ -1931,19 +2082,19 @@
                TextSize = 15,
            };
            bjFrameLayout.AddChidren(recommendtextBtn);
            //推荐模板开关控件
            var recommendswitchBtn = new Button
            {
                Width = Application.GetMinRealAverage(104),
                Height = Application.GetMinRealAverage(63),
                Width = Application.GetRealWidth(104),
                Height = Application.GetRealHeight(63),
                UnSelectedImagePath = "ZigeeLogic/logicclose.png",
                SelectedImagePath = "ZigeeLogic/logicopen.png",
                X = bjFrameLayout.Width - Application.GetRealWidth(104 + 58),
                Gravity = Gravity.CenterVertical,
            };
            bjFrameLayout.AddChidren(recommendswitchBtn);
            #endregion
            //默认推荐模板左右可滑控件
            var scenehorizontalScrol = new HorizontalScrolViewLayout
            {
                Width = Application.GetRealWidth(1080 - 58),
@@ -1952,7 +2103,7 @@
                Height = Application.GetRealHeight(0),
            };
            functionSceneAutoBodyView.AddChidren(scenehorizontalScrol);
            //显示自动化列表上下可滑控件
            var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout
            {
                Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30),
@@ -1963,6 +2114,7 @@
            functionSceneAutoBodyView.AddChidren(logicScrolView);
            logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
            bool no = false;
            //显示默认模板的界面事件
            recommendswitchBtn.MouseUpEventHandler += (sender, e) =>
            {
                int Yheight = 0;
@@ -2023,7 +2175,8 @@
                            Common.Logic.CurrentLogic.IsEnable = 1;//默认为开
                            if (logiciocnBtn.Tag.ToString() == "3")
                            {
                                Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;// Language.StringByID(MyInternationalizationString.automation1);
                                Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;
                                //Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
                                var addLogicPage = new Logic.AddLogicPage();
                                HomePage.Instance.AddChidren(addLogicPage);
                                HomePage.Instance.PageIndex += 1;
@@ -2033,6 +2186,7 @@
                            {
                                Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;
                                //Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
                                Logic.TemplatePage templatePage = new Logic.TemplatePage();
                                Logic.TemplatePage.s = logiciocnBtn.Tag.ToString();
                                HomePage.Instance.AddChidren(templatePage);
@@ -2052,25 +2206,36 @@
                }
                logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
                Automationview(logicScrolView,no);
                Automationview(logicScrolView, no);
            };
            //下拉刷新自动化列表的事件
            logicScrolView.BeginHeaderRefreshingAction += () =>
            {
                //重新刷新logic列表
                Common.Logic.LogicList.Clear();
                Read(logicScrolView, no);
                //关闭刷新View;
                logicScrolView.EndHeaderRefreshing();
            };
            logicScrolView.BeginHeaderRefreshingAction += () =>
            {
                //重新刷新logic列表
                Common.Logic.LogicList.Clear();
                Read(logicScrolView,no);
                Read(logicScrolView, no);
                //关闭刷新View;
                logicScrolView.EndHeaderRefreshing();
            };
            Read(logicScrolView,no);
            };
            Read(logicScrolView, no);
            Read(logicScrolView, no);
        }
        /// <summary>
        /// 读取自动化列表数据;
        /// </summary>
        /// <param name="logicScrolView"></param>
        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
        private async void Read(VerticalRefreshLayout logicScrolView, bool no)
        {
            CommonPage.Loading.Start();
            if (Common.Logic.LogicList.Count == 0)
@@ -2092,23 +2257,23 @@
                }
            }
            //自动化
            Automationview(logicScrolView,no);
            Automationview(logicScrolView, no);
            CommonPage.Loading.Hide();
        }
        /// <summary>
        /// 加载自动化列表界面
        /// </summary>
        /// <param name="refresview">Refresview.</param>
        private async void Automationview(VerticalRefreshLayout refresview,bool no)
        private async void Automationview(VerticalRefreshLayout refresview, bool no)
        {
            refresview.RemoveAll();
            if (Common.Logic.LogicList.Count == 0&&no==false)
            if (Common.Logic.LogicList.Count == 0 && no == false)
            {
                //就是为了显示引导添加图标;
                refresview.BackgroundColor = 0x00000000;
                var noFrameLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(434+ 200+32+160),
                    Height = Application.GetRealHeight(434 + 200 + 32 + 160),
                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
                refresview.AddChidren(noFrameLayout);
@@ -2116,7 +2281,7 @@
                var noIconBtn = new Button
                {
                    Y=Application.GetRealHeight(160),
                    Y = Application.GetRealHeight(160),
                    Width = Application.GetMinRealAverage(756),
                    Height = Application.GetMinRealAverage(434),
                    UnSelectedImagePath = "Item/NoFunction.png",
@@ -2127,14 +2292,14 @@
                var noTextBtn = new Button()
                {
                    Y = noIconBtn.Bottom,
                    Height = Application.GetRealHeight(200)+Application.GetRealHeight(32),
                    Height = Application.GetRealHeight(200) + Application.GetRealHeight(32),
                    Width = Application.GetRealWidth(700),
                    //Gravity = Gravity.CenterHorizontal,
                    Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"),
                    TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
                    TextAlignment = TextAlignment.Center,
                    IsMoreLines = true,
                    X = Application.GetRealWidth(190-58),
                    X = Application.GetRealWidth(190 - 58),
                };
                noFrameLayout.AddChidren(noTextBtn);
@@ -2152,21 +2317,27 @@
                    refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
                }
            }
            foreach (var logic in Common.Logic.LogicList)
            {
                var fLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(190 + 30),
                    Width = Application.GetRealWidth(1080 - 58),
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
                refresview.AddChidren(fLayout);
                var logicRowlayout = new RowLayout
                {
                    Height = Application.GetRealHeight(190 + 30),
                    Width = Application.GetRealWidth(1080-58),
                    Width = Application.GetRealWidth(1080 - 58),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                   BackgroundColor =ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                    SubViewWidth = Application.GetRealWidth(184),//改变编辑控件宽度多少;
                };
                refresview.AddChidren(logicRowlayout);
                fLayout.AddChidren(logicRowlayout);
                var logicnameBtn = new Button
                {
@@ -2181,7 +2352,6 @@
                };
                logicRowlayout.AddChidren(logicnameBtn);
                var logicswitchBtn = new Button
                {
                    Width = Application.GetMinRealAverage(104),
@@ -2190,10 +2360,9 @@
                    SelectedImagePath = "ZigeeLogic/logicopen.png",
                    X = logicRowlayout.Width - Application.GetRealWidth(104 + 58),
                    Y = Application.GetRealHeight(58 + 30 + 9 + 30),
                };
                logicRowlayout.AddChidren(logicswitchBtn);
                logicswitchBtn.MouseUpEventHandler += (sender1, e1) =>
                {
@@ -2237,10 +2406,9 @@
                    var logicCommunalPage = new Logic.LogicCommunalPage();
                    HomePage.Instance.AddChidren(logicCommunalPage);
                    HomePage.Instance.PageIndex += 1;
                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); });
                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview, no); });
                };
                ///删除
                var del = new Button
@@ -2259,22 +2427,21 @@
                        if (e1)
                        {
                            Common.Logic.LogicList.Remove(logic);
                            Automationview(refresview,no);
                            Automationview(refresview, no);
                            Logic.Send.DelLogic(logic.LogicId);
                        }
                    };
                    alert.Show();
                };
                var line = new Button
                {
                    Y = Application.GetRealHeight(215),
                    Height = Application.GetRealHeight(5),
                    Y = fLayout.Height-1,
                    Height =1,
                    X = Application.GetRealWidth(58),
                    Width = Application.GetRealWidth(1080 - 58),
                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                    X = Application.GetRealWidth(58),
                };
                logicRowlayout.AddChidren(line);
                fLayout.AddChidren(line);
            }
        }
@@ -2299,254 +2466,8 @@
            logicRowlayout.AddChidren(logictimeBtn);
            ///显示执行周期
            switch (logic.TimeAttribute.Repeat)
            {
                ///0:只执行一次,执行后IsEnable值置;1,今年内执行;2:每天执行;3:每月执行;4:每年执行;5:周重复。
                case 0:
                    {
                        logictimeBtn.Text = Language.StringByID(MyInternationalizationString.executeonce);
                    }; break;
                case 1: { }; break;
                case 2:
                    {
                        logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyday);
                    }; break;
                case 3:
                    {
            Logic.Method.UpdateWeek(logictimeBtn, logic);
                        string len = "", value = "";
                        var stringvalue = Convert.ToString(logic.TimeAttribute.MonthDate, 2);
                        var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length));
                        for (int j = 31; j >= 0; j--)
                        {
                            len += str.Substring(j, 1);
                        }
                        for (int j = 0; j < len.Length; j++)
                        {
                            var strvalue = len.Substring(j, 1);
                            if (strvalue == "1")
                            {
                                value += (j + 1).ToString() + ",";
                            }
                        }
                        logictimeBtn.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day);
                    }; break;
                case 4:
                    {
                        Dictionary<int, int> dictionary = new Dictionary<int, int>();
                        ///找出执行的月份和天数
                        if (logic.TimeAttribute.SelectMonDate.Count != 0)
                        {
                            for (int i = 0; i < logic.TimeAttribute.SelectMonDate.Count; i++)
                            {
                                var dayvalue = logic.TimeAttribute.SelectMonDate[i];
                                if (dayvalue != 0)
                                {
                                    dictionary.Add(i + 1, dayvalue);
                                }
                            }
                        }
                        if (dictionary.Count != 0 && dictionary.Count == 1)
                        {
                            string len = "", leng = "";
                            int minvalue = 0, Maximum = 0;
                            foreach (var value in dictionary)
                            {
                                ///取出月份
                                var month = value.Key;
                                ///取出日数
                                var day = value.Value;
                                var maxvalue = Convert.ToString(day, 2);
                                var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length));
                                for (int j = 31; j >= 0; j--)
                                {
                                    len += str.Substring(j, 1);
                                }
                                for (int j = 0; j < len.Length; j++)
                                {
                                    var strvalue = len.Substring(j, 1);
                                    if (strvalue == "1")
                                    {
                                        minvalue = j + 1;
                                        break;
                                    }
                                }
                                for (int j = 0; j < len.Length; j++)
                                {
                                    var strvalue = len.Substring(j, 1);
                                    if (strvalue == "1")
                                    {
                                        Maximum = j + 1;
                                    }
                                }
                                if (month.ToString().Length < 2)
                                {
                                    leng = "0" + month.ToString();
                                }
                                else
                                {
                                    leng = month.ToString();
                                }
                                if (minvalue == Maximum)
                                {
                                    logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString());
                                }
                                else
                                {
                                    logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString());
                                }
                            }
                        }
                        else
                        {
                            int b = 0;
                            string stringtext = "";
                            foreach (var value in dictionary)
                            {
                                string len = "", leng = "";
                                int minvalue = 0, Maximum = 0;
                                ///取出月份
                                var month = value.Key;
                                ///取出日数
                                var day = value.Value;
                                var maxvalue = Convert.ToString(day, 2);
                                var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length));
                                for (int j = 31; j >= 0; j--)
                                {
                                    len += str.Substring(j, 1);
                                }
                                if (month.ToString().Length < 2)
                                {
                                    leng = "0" + month.ToString();
                                }
                                else
                                {
                                    leng = month.ToString();
                                }
                                if (b == 0)
                                {
                                    for (int j = 0; j < len.Length; j++)
                                    {
                                        var strvalue = len.Substring(j, 1);
                                        if (strvalue == "1")
                                        {
                                            minvalue = j + 1;
                                            break;
                                        }
                                    }
                                    stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-";
                                }
                                if (b == dictionary.Count - 1)
                                {
                                    for (int j = 0; j < len.Length; j++)
                                    {
                                        var strvalue = len.Substring(j, 1);
                                        if (strvalue == "1")
                                        {
                                            Maximum = j + 1;
                                        }
                                    }
                                    stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString());
                                }
                                b++;
                            }
                            logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext;
                        }
                    }; break;
                case 5:
                    {
                        string len = "", text = "";
                        List<int> listvalueInt = new List<int>();
                        listvalueInt.Clear();
                        var maxvalue = Convert.ToString(logic.TimeAttribute.WeekDay, 2);
                        var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length));
                        for (int j = 7; j >= 0; j--)
                        {
                            len += str.Substring(j, 1);
                        }
                        for (int j = 0; j < len.Length; j++)
                        {
                            var strvalue = len.Substring(j, 1);
                            if (strvalue == "1")
                            {
                                listvalueInt.Add(j + 1);
                                if ((j + 1) == 1)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.mon) + ",";
                                }
                                else if ((j + 1) == 2)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.tue) + ",";
                                }
                                else if ((j + 1) == 3)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.wed) + ",";
                                }
                                else if ((j + 1) == 4)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.thu) + ",";
                                }
                                else if ((j + 1) == 5)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.frl) + ",";
                                }
                                else if ((j + 1) == 6)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.sat) + ",";
                                }
                                else if ((j + 1) == 7)
                                {
                                    text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ",";
                                    //text += Language.StringByID(MyInternationalizationString.sun) + ",";
                                }
                            }
                        }
                        //暂时隐藏掉,需要显示周末和工作日再放开;
                        //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7))
                        //{
                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday);
                        //}
                        //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7))
                        //{
                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend);
                        //}
                        //else if (listvalueInt.Count == 7)
                        //{
                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday);
                        //}
                        //else
                        //{
                        //    btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(',');
                        //}
                        logictimeBtn.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(',');
                        //btndisplaycycle.Text = text.TrimEnd(',');
                    }; break;
            }
            List<string> indexlist = new List<string>();
            List<string> iconIndexlist = new List<string>();
@@ -2580,19 +2501,19 @@
                var iconindex = iconIndexlist[i];
                var typebjBtn = new FrameLayout
                {
                    Width = Application.GetRealWidth(82),
                    Height = Application.GetRealHeight(82),
                    Width = Application.GetMinRealAverage(82),
                    Height = Application.GetMinRealAverage(82),
                    X = Application.GetRealWidth(58) + Application.GetRealWidth(12 + (12 + 82 + 45 + 12) * i),
                    Y = Application.GetRealHeight(58 + 30 + 30),
                    Radius = (uint)Application.GetRealHeight(41),
                    Radius = (uint)Application.GetMinRealAverage(41),
                    BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
                logicRowlayout.AddChidren(typebjBtn);
                var typeIconBtn = new Button
                {
                    Width = Application.GetRealWidth(58),
                    Height = Application.GetRealHeight(58),
                    Width = Application.GetMinRealAverage(58),
                    Height = Application.GetMinRealAverage(58),
                    Gravity = Gravity.Center,
                };
@@ -2749,10 +2670,10 @@
            {
                commonDeviceList.Add(common);
            }
        }
        }
        #endregion
    }
}