gxc
2019-12-25 944b87b6bcccb095cd73f13f4410fb20faf48f74
ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
old mode 100644 new mode 100755
@@ -9,102 +9,152 @@
namespace Shared.Phone.Device.Logic
{
    public class DeviceStateCondition :FrameLayout
    public class DeviceStateCondition : FrameLayout
    {
        public DeviceStateCondition()
        {
            Tag = "Logic";
        }
        Button SelectedButton = new Button();
        HorizontalScrolViewLayout horizontalScrol;
        Button roombjButton = new Button();
        Button roomTextButton = new Button();
        Button devicetypeButton = new Button();
        VerticalScrolViewLayout middle;
        FrameLayout clickframeLayout = new FrameLayout();
        Button clickbutton = new Button();
        Button clicktextcolcrbutton = new Button();
        public void Show()
        {
            UserView.HomePage.Instance.ScrollEnabled = false;
            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
            var topFrameLayout = new RowLayout
            UserView.HomePage.Instance.ScrollEnabled = false;
            this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            #region  最上面的布局代码
            var topRowLayout = new RowLayout
            {
                Height = Application.GetRealHeight(220),
                Y = Application.GetRealHeight(80),
                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
                Height = Application.GetRealHeight(184),
                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
            };
            AddChidren(topFrameLayout);
            this.AddChidren(topRowLayout);
            var titleName = new Button
            {
                TextID = MyInternationalizationString.devicestate,
                TextSize = 17,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(150),
                X = Application.GetRealWidth(160),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                TextID = MyInternationalizationString.devicestate,
            };
            topFrameLayout.AddChidren(titleName);
            topRowLayout.AddChidren(titleName);
            var clickBtn = new Button
            {
                Width = Application.GetRealWidth(81 + 51),
                Height = Application.GetRealHeight(58 + 40),
                Y = Application.GetRealHeight(98 - 40),
            };
            topRowLayout.AddChidren(clickBtn);
            clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
            };
            var back = new Button
            {
                Width = Application.GetRealWidth(110),
                Height = Application.GetRealHeight(110),
                X = Application.GetRealWidth(20),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "ZigeeLogic/Back.png",
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealHeight(51),
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(98),
                //Gravity = Gravity.CenterVertical;
                UnSelectedImagePath = "ZigeeLogic/back.png",
            };
            topFrameLayout.AddChidren(back);
            topRowLayout.AddChidren(back);
            back.MouseDownEventHandler += (sender, e) =>
            {
                RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
            };
            var roomname = new Button
            var foolrname = new Button
            {
                Width = Application.GetMinRealAverage(300 + 300-30),
                Height = Application.GetMinRealAverage(80),
                X = Application.GetRealWidth(1080 - 300 - 30 - 300),
                Y = Application.GetRealHeight(120),
                TextAlignment = TextAlignment.CenterRight,
                //Text = "自定义房间",
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextID=MyInternationalizationString.customroom,
                TextAlignment = TextAlignment.CenterRight,
                X = Application.GetRealWidth(1080 - 400 - 120),
                Width = Application.GetRealWidth(400),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                //TextID = MyInternationalizationString.customroom,
                Text = Config.Instance.Home.GetCurrentFloorName,
                TextSize = 14,
            };
            topFrameLayout.AddChidren(roomname);
            var horizontalScrolfl = new FrameLayout
            topRowLayout.AddChidren(foolrname);
            var dropdown = new Button
            {
                Height = Application.GetRealHeight(220 + 30),
                Y = topFrameLayout.Bottom,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterRight,
                X = foolrname.Right,
                Width = Application.GetRealWidth(72),
                Height = Application.GetRealHeight(72),
                Y = Application.GetRealHeight(92),
                UnSelectedImagePath = "ZigeeLogic/drop-down.png",
            };
            topRowLayout.AddChidren(dropdown);
            #endregion
            ///没有房间直接返回去;
            if (Common.Room.Lists.Count == 0)
            {
                return;
            }
            ///房间滑动控件
            var roomhorizontalScrol = new HorizontalScrolViewLayout()
            {
                Width = Application.GetRealWidth(1080 - 58),
                Height = Application.GetRealHeight(200),
                Y = topRowLayout.Bottom,
                X = Application.GetRealWidth(58),
            };
            this.AddChidren(roomhorizontalScrol);
            ///设备类型滑动控件
            var devicetypehorizontalScrol = new HorizontalScrolViewLayout()
            {
                Width = Application.GetRealWidth(1080 - 58),
                Height = Application.GetRealHeight(280),
                Y = roomhorizontalScrol.Bottom,
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
            };
            AddChidren(horizontalScrolfl);
                X = Application.GetRealWidth(58),
               // Radius = (uint)Application.GetRealHeight(50),
             horizontalScrol = new HorizontalScrolViewLayout()
            {
                Width = Application.GetRealWidth(1080 - 40),
                Height = Application.GetRealHeight(180 + 30),
                Y = Application.GetRealHeight(40),
                X = Application.GetRealWidth(40),
                Radius = (uint)Application.GetRealHeight(30),
            };
            horizontalScrolfl.AddChidren(horizontalScrol);
            this.AddChidren(devicetypehorizontalScrol);
            devicetypehorizontalScrol.SetCornerWithSameRadius(20,HDLUtils.RectCornerBottomLeft);
             middle = new VerticalScrolViewLayout();
            middle.Y = horizontalScrolfl.Bottom;
            middle.Height = Application.GetRealHeight(1920 - 300 - 250);
            middle = new VerticalScrolViewLayout();
            middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40);
            middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom;
            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
            middle.X = Application.GetRealWidth(58);
            //middle.Radius = (uint)Application.GetRealHeight(50);
            this.AddChidren(middle);
            ///过滤掉的设备
            List<DeviceType> deviceTypeList = new List<DeviceType> {
                DeviceType.ColorDimmableLight,
                 DeviceType.OnOffOutput,
                  DeviceType.WindowCoveringDevice,
                   DeviceType.AirSwitch,
            middle.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft);
            ///目前支持的设备
            var deviceTypeList = new List<DeviceType> {
                DeviceType.IASZone,
                DeviceType.OnOffSwitch,
                DeviceType.OnOffOutput,//楼梯灯
                DeviceType.DoorLock,
                DeviceType.TemperatureSensor,
            };
            ///房间点击事件
            roomname.MouseUpEventHandler += (sender, e) =>
            ///楼层点击事件
            EventHandler<MouseEventArgs> foorlclick = (sender, e) =>
            {
                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
@@ -113,94 +163,251 @@
                {
                    flMain.RemoveFromParent();
                };
                var roombj = new VerticalScrolViewLayout
                var foolrbjicon = new FrameLayout
                {
                    Width = Application.GetRealWidth(400),
                    Height = Application.GetRealHeight(600),
                    X = Application.GetRealWidth(1080 - 400 - 60),
                    Y = Application.GetRealHeight(220 + 30 + 80),
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                    Radius = (uint)Application.GetRealHeight(30),
                    Width = Application.GetRealWidth(450),
                    Height = Application.GetRealHeight(780),
                    X = Application.GetRealWidth(1080 - 468 - 35),
                    Y = Application.GetRealHeight(184),
                    BackgroundImagePath = "Item/SelectFloor_Right.png",
                };
                flMain.AddChidren(roombj);
                List<Common.Room> roomlist = new List<Common.Room>();
                roomlist.Clear();
                Common.Room customroom = new Common.Room();
                customroom.Name =Language.StringByID(MyInternationalizationString.customroom);
                foreach (var device in Common.Logic.LogicDviceList)
                {
                    var deviceui = customroom.GetDeviceUI(device);
                    if (deviceui != null)
                    {
                        customroom.DeviceUIList.Add(deviceui);
                    }
                flMain.AddChidren(foolrbjicon);
                }
                roomlist.Add(customroom);
                roomlist.AddRange(Common.Room.Lists);
                foreach (var room in roomlist)
                var btnfoolrtext = new Button
                {
                    var rowLayout = new RowLayout
                    Width = Application.GetRealWidth(450),
                    Height = Application.GetRealHeight(150),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                    X = Application.GetRealWidth(80),
                    TextID = MyInternationalizationString.selecfoolr,
                    TextSize = 14,
                };
                foolrbjicon.AddChidren(btnfoolrtext);
                var foolrbj = new VerticalScrolViewLayout
                {
                    Width = Application.GetRealWidth(450),
                    Height = foolrbjicon.Height - btnfoolrtext.Height,
                    X = Application.GetRealWidth(80),
                    Y = btnfoolrtext.Bottom,
                };
                foolrbjicon.AddChidren(foolrbj);
                foreach (var foolr in Config.Instance.Home.FloorDics)
                {
                    var foolrRowLayout = new RowLayout
                    {
                        Height = Application.GetRealHeight(150),
                        LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                    };
                    roombj.AddChidren(rowLayout);
                    foolrbj.AddChidren(foolrRowLayout);
                    var btnroomname = new Button
                    var btnfoolricon = new Button
                    {
                        Width = Application.GetRealWidth(300),
                        Text = room.Name,
                        Width = Application.GetRealWidth(81),
                        Height = Application.GetRealHeight(81),
                        UnSelectedImagePath = "Floor/Floor.png",
                        Gravity = Gravity.CenterVertical,
                    };
                    foolrRowLayout.AddChidren(btnfoolricon);
                    var btnfoolrname = new Button
                    {
                        Width = Application.GetRealWidth(250),
                        Height = Application.GetRealHeight(150),
                        Text = foolr.Value,
                        TextAlignment = TextAlignment.CenterLeft,
                        X = Application.GetRealWidth(30),
                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                        TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                        Tag = foolr.Key,
                        X = btnfoolricon.Right + Application.GetRealWidth(12),
                        TextSize = 14,
                    };
                    rowLayout.AddChidren(btnroomname);
                    foolrRowLayout.AddChidren(btnfoolrname);
                    if (foolrname.Text == foolr.Value)
                    {
                        btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
                        btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
                    }
                    EventHandler<MouseEventArgs> roomclick = (sender1, e1) =>
                    EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
                    {
                        roomhorizontalScrol.RemoveAll();
                        devicetypehorizontalScrol.RemoveAll();
                        middle.RemoveAll();
                        foolrname.Text = btnfoolrname.Text;
                        flMain.RemoveFromParent();
                        roomname.Text = room.Name;
                        var list = new List<DeviceUI>();
                        foreach (var device in room.DeviceUIList)
                        {
                            if (!deviceTypeList.Contains(device.CommonDevice.Type))
                            {
                                list.Add(device);
                            }
                        }
                        AllDeviceTypeView(list);
                        var list = Send.GetRoomList(btnfoolrname.Tag.ToString());
                        AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
                    };
                    rowLayout.MouseUpEventHandler += roomclick;
                    btnroomname.MouseUpEventHandler += roomclick;
                    foolrRowLayout.MouseUpEventHandler += foolrnameclick;
                    btnfoolrname.MouseUpEventHandler += foolrnameclick;
                }
            };
            Common.Room room1= new Common.Room();
            foreach (var device in Common.Logic.LogicDviceList)
            foolrname.MouseUpEventHandler += foorlclick;
            dropdown.MouseUpEventHandler += foorlclick;
            ///第一次进来
            var roomlists = new List<Common.Room>();
            roomlists.Clear();
            if (Config.Instance.Home.FloorDics.Count < 2)
            {
                if (deviceTypeList.Contains(device.Type))
                foolrname.Visible = false;
                dropdown.Visible = false;
                if (Config.Instance.Home.FloorDics.Count == 0)
                {
                    continue;
                    roomlists.AddRange(Common.Room.Lists);
                }
                var deviceui = room1.GetDeviceUI(device);
                if (deviceui != null)
                else
                {
                    room1.DeviceUIList.Add(deviceui);
                    roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
                }
            }
            else
            {
                roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
            }
            AllDeviceTypeView(room1.DeviceUIList);
            AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
        }
        /// <summary>
        /// 加载所有房间的视图方法
        /// </summary>
        void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol)
        {
            for (int i = 0; i < roomlist.Count; i++)
            {
                var room = roomlist[i];
                var fra = new FrameLayout
                {
                    Height = Application.GetRealHeight(200),
                    Width = Application.GetRealWidth(255),
                };
                roomhorizontalScrol.AddChidren(fra);
                var roombjBtn = new Button
                {
                    Height = Application.GetRealHeight(158),
                    Width = Application.GetRealWidth(255),
                    UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png",
                    SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png",
                    Y = Application.GetRealHeight(21),
                };
                fra.AddChidren(roombjBtn);
                var roomnameBtn = new Button
                {
                    Height = Application.GetRealHeight(152 - 26 - 20),
                    Width = Application.GetRealWidth(255 - 20 - 50),
                    Text = room.Name,
                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                    SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                    Y = Application.GetRealHeight(21 + 13 + 10),
                    X = Application.GetRealWidth(10 + 25),
                };
                fra.AddChidren(roomnameBtn);
                if (i == 0)//
                {
                    roombjButton.IsSelected = false;
                    roombjButton = roombjBtn;
                    roombjBtn.IsSelected = true;
                    roomTextButton.IsSelected = false;
                    roomTextButton = roomnameBtn;
                    roomnameBtn.IsSelected = true;
                    var list = new List<DeviceUI>();
                    foreach (var device in room.DeviceUIList)
                    {
                        if (device.CommonDevice == null)
                        {
                            continue;
                        }
                        if (!deviceTypeList.Contains(device.CommonDevice.Type))
                        {
                            continue;
                        }
                        list.Add(device);
                    }
                    if (list.Count == 0)
                    {
                        devicetypehorizontalScrol.Height = 0;
                        middle.Height = 0;
                    }
                    else
                    {
                        devicetypehorizontalScrol.Height = Application.GetRealHeight(280);
                        middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom;
                    }
                    AllDeviceTypeView(list, devicetypehorizontalScrol);
                }
                EventHandler<MouseEventArgs> roomclick = (sender, e) =>
                {
                    roombjButton.IsSelected = false;
                    roombjButton = roombjBtn;
                    roombjBtn.IsSelected = true;
                    roomTextButton.IsSelected = false;
                    roomTextButton = roomnameBtn;
                    roomnameBtn.IsSelected = true;
                    var list = new List<DeviceUI>();
                    foreach (var device in room.DeviceUIList)
                    {
                        if (device.CommonDevice == null)
                        {
                            continue;
                        }
                        if (!deviceTypeList.Contains(device.CommonDevice.Type))
                        {
                            continue;
                        }
                        list.Add(device);
                    }
                    if (list.Count == 0)
                    {
                        devicetypehorizontalScrol.Height = 0;
                        middle.Height = 0;
                    }
                    else
                    {
                        devicetypehorizontalScrol.Height = Application.GetRealHeight(280);
                        middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom;
                    }
                    AllDeviceTypeView(list, devicetypehorizontalScrol);
                };
                roomnameBtn.MouseUpEventHandler += roomclick;
                roombjBtn.MouseUpEventHandler += roomclick;
            }
        }
        /// <summary>
        /// 加载该区域所有设备视图方法
        /// </summary>0
        /// <param name="devicelist">Devicelist.</param>
        void AllDeviceTypeView(List<DeviceUI> devicelist)
        void AllDeviceTypeView(List<DeviceUI> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol)
        {
            List<string> devicetypelist = new List<string>();
            devicetypelist.Clear();
@@ -217,7 +424,7 @@
                devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains));
            }
            var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone);
            var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone || device.CommonDevice.Type == DeviceType.TemperatureSensor);
            if (iASZonejosn != null)
            {
                devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor));
@@ -227,65 +434,100 @@
            {
                devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch));
            }
            #endregion
            horizontalScrol.RemoveAll();
            foreach (var devicetype in devicetypelist)
            var doorLock = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DoorLock);
            if (doorLock != null)
            {
                devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock));
            }
            #endregion
            devicetypehorizontalScrol.RemoveAll();
            for (int i = 0; i < devicetypelist.Count; i++)
            {
                var devicetype = devicetypelist[i];
                var spaceRowLayout = new FrameLayout();
                devicetypehorizontalScrol.AddChidren(spaceRowLayout);
                if (i == 0)
                {
                    spaceRowLayout.Width = Application.GetRealWidth(37);
                }
                else
                {
                    spaceRowLayout.Width = Application.GetRealWidth(80);
                }
                var deviceRowLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(180 + 30),
                    Width = Application.GetRealWidth(250),
                    Width = Application.GetRealWidth(156 + 20),
                    Height = Application.GetRealHeight(280 - 30),
                    Y = Application.GetRealHeight(30),
                };
                horizontalScrol.AddChidren(deviceRowLayout);
                devicetypehorizontalScrol.AddChidren(deviceRowLayout);
                var backgroundColor = new Button
                {
                    Width = Application.GetRealWidth(156),
                    Height = Application.GetRealHeight(180),
                    X = Application.GetRealWidth(10),
                    UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png",
                    SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png",
                };
                deviceRowLayout.AddChidren(backgroundColor);
                var devicetypeicon = new Button
                {
                    Width = Application.GetRealWidth(110),
                    Height = Application.GetRealHeight(110),
                    X = Application.GetRealWidth(70),
                    Width = Application.GetRealWidth(84),
                    Height = Application.GetRealHeight(84),
                    X = Application.GetRealWidth(46),
                    Y = Application.GetRealHeight(30),
                };
                deviceRowLayout.AddChidren(devicetypeicon);
                if (devicetype == Language.StringByID(MyInternationalizationString.Lights))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Light.png";
                    devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Curtain.png";
                    devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/OnOffSwitch.png";
                    devicetypeicon.SelectedImagePath = "ZigeeLogic/OnOffSwitchSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.sensor))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Sensor.png";
                    devicetypeicon.SelectedImagePath = "ZigeeLogic/SensorSelected.png";
                }
                var devicetypename = new Button
                {
                    Width = Application.GetRealWidth(250),
                    Height = Application.GetRealHeight(50),
                    Width = Application.GetRealWidth(176),
                    Height = Application.GetRealHeight(40),
                    Text = devicetype,
                    TextAlignment = TextAlignment.Center,
                    Y = devicetypeicon.Bottom + Application.GetRealHeight(20),
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                    Y = backgroundColor.Bottom,
                    TextColor = ZigbeeColor.Current.LogicAddColor,
                    TextSize = 10,
                };
                deviceRowLayout.AddChidren(devicetypename);
                if (devicetype == Language.StringByID(MyInternationalizationString.Lights))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png";
                    // devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png";
                    //devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedpanel.png";
                    // devicetypeicon.SelectedImagePath = "ZigeeLogic/OnOffSwitchSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.sensor))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedsenor.png";
                    // devicetypeicon.SelectedImagePath = "ZigeeLogic/SensorSelected.png";
                }
                else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock))
                {
                    devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selecteddoorlock.png";
                }
                EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) =>
                {
                    List<DeviceType> list = new List<DeviceType>();
                    list.Clear();
                    SelectedButton.IsSelected = false;
                    SelectedButton = devicetypeicon;
                    SelectedButton.IsSelected = true;
                    devicetypeButton.IsSelected = false;
                    devicetypeButton = backgroundColor;
                    backgroundColor.IsSelected = true;
                    ///分类显示(例如灯光:{灯光1,灯光2...})
                    if (devicetype == Language.StringByID(MyInternationalizationString.Lights))
                    {
@@ -302,6 +544,11 @@
                    else if (devicetype == Language.StringByID(MyInternationalizationString.sensor))
                    {
                        list.Add(DeviceType.IASZone);
                        list.Add(DeviceType.TemperatureSensor);
                    }
                    else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock))
                    {
                        list.Add(DeviceType.DoorLock);
                    }
                    ConditionDeviceView(list, devicelist);
@@ -310,6 +557,7 @@
                deviceRowLayout.MouseUpEventHandler += devicetypeclick;
                devicetypename.MouseUpEventHandler += devicetypeclick;
                devicetypeicon.MouseUpEventHandler += devicetypeclick;
                backgroundColor.MouseUpEventHandler += devicetypeclick;
            }
            ///显示房间所有设备
@@ -333,44 +581,124 @@
                    continue;
                }
                var row = new RowLayout
                var deviceFramelayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(180),
                    Height = Application.GetRealHeight(160),
                };
                middle.AddChidren(deviceFramelayout);
                var bjFramelayout = new FrameLayout
                {
                    Width = Application.GetRealWidth(112),
                    Height = Application.GetRealHeight(112),
                    X = Application.GetRealWidth(58),
                    Y = Application.GetRealHeight(30 + 9),
                   // Radius = (uint)Application.GetRealHeight(56),
                    BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
                deviceFramelayout.AddChidren(bjFramelayout);
                var deviceIconBtn = new Button
                {
                    Width = Application.GetRealWidth(82),
                    Height = Application.GetRealHeight(82),
                    Gravity = Gravity.Center,
                };
                middle.AddChidren(row);
                bjFramelayout.AddChidren(deviceIconBtn);
                var deviceRow = new RowLayout
                {
                    Y = Application.GetRealHeight(30),
                    Width = Application.GetRealWidth(850),
                    Height = Application.GetRealHeight(130),
                    X = Application.GetRealWidth(176 + 10),
                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                };
                deviceFramelayout.AddChidren(deviceRow);
                var devicename = new Button
                {
                    Gravity = Gravity.CenterVertical,
                    TextAlignment = TextAlignment.CenterLeft,
                    X = Application.GetRealWidth(40),
                    Width = Application.GetRealWidth(600),
                    //SelectedBackgroundColor = 0xFFE9652D,
                    Text = common.CommonDevice.DeviceEpointName,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                    SelectedTextColor = ZigbeeColor.Current.LogicAddColor,
                    TextSize = 14,
                };
                row.AddChidren(devicename);
                var btndeviceback = new Button
                deviceRow.AddChidren(devicename);
                switch (common.CommonDevice.Type)
                {
                    Width = Application.GetRealWidth(110),
                    Height = Application.GetRealHeight(110),
                    UnSelectedImagePath = "ZigeeLogic/Next.png",
                    X = Application.GetRealWidth(1080 - 140),
                    Gravity = Gravity.CenterVertical,
                };
                row.AddChidren(btndeviceback);
                    case DeviceType.OnOffOutput:
                        {
                            deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png";
                            deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png";
                        }
                        break;
                    case DeviceType.IASZone:
                        {
                            var iASZonedevice = common.CommonDevice as IASZone;
                            if (iASZonedevice.DeviceID != 1026)
                            {
                                break;
                            }
                            deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
                            deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png";
                        }
                        break;
                    case DeviceType.TemperatureSensor:
                        {
                            var temperatureSensor = common.CommonDevice as TemperatureSensor;
                            if (temperatureSensor.SensorDiv == 1)
                            {
                                deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/temperature.png";
                                deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedtemperature.png";
                            }
                            else
                            {
                                deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/humidity.png";
                                deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedhumidity.png";
                            }
                        }
                        break;
                    case DeviceType.OnOffSwitch:
                        {
                            deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/panel.png";
                            deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedpanel.png";
                        }
                        break;
                    case DeviceType.DoorLock:
                        {
                            deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png";
                            deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddoorlock.png";
                        }
                        break;
                }
                EventHandler<MouseEventArgs> devicclick = (sen, e) =>
                {
                    clickbutton.IsSelected = false;
                    clickbutton = deviceIconBtn;
                    deviceIconBtn.IsSelected = true;
                    clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
                    clickframeLayout = bjFramelayout;
                    bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor;
                    clicktextcolcrbutton.IsSelected = false;
                    clicktextcolcrbutton = devicename;
                    devicename.IsSelected = true;
                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                    this.AddChidren(flMain);
                    CurrentDeviceView(flMain, common.CommonDevice, false);
                };
                row.MouseUpEventHandler += devicclick;
                deviceFramelayout.MouseUpEventHandler += devicclick;
                bjFramelayout.MouseUpEventHandler += devicclick;
                deviceIconBtn.MouseUpEventHandler += devicclick;
                deviceRow.MouseUpEventHandler += devicclick;
                devicename.MouseUpEventHandler += devicclick;
                btndeviceback.MouseUpEventHandler += devicclick;
            }
        }
@@ -378,59 +706,87 @@
        /// 选中该设备功能作为条件的视图方法
        /// </summary>
        /// <param name="common">Common.</param>
        public static  void CurrentDeviceView(FrameLayout flMain,CommonDevice common,bool edit)
        public async static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit)
        {
            //不让当前界面滑动
            UserView.HomePage.Instance.ScrollEnabled = false;
            List<Dictionary<string, string>> doorlockConditionsInfo = new List<Dictionary<string, string>>();
            Dictionary<string, string> deviceConditionsInfo = new Dictionary<string, string>();
            dictionary(deviceConditionsInfo, "Type", "1");
            dictionary(deviceConditionsInfo, "IsValid", "1");
            dictionary(deviceConditionsInfo, "MacAddr", common.DeviceAddr);
            dictionary(deviceConditionsInfo, "Epoint", common.DeviceEpoint.ToString());
            //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
            //this.AddChidren(flMain);
            flMain.MouseUpEventHandler += (sender, e) =>
            {
                flMain.RemoveFromParent();
            };
            var devicefra = new FrameLayout
            {
                Width = Application.GetRealWidth(1080 - 80),
                X = Application.GetRealWidth(40),
                Width = Application.GetRealWidth(1080),
                Height = Application.GetRealHeight(530),
                Y = Application.GetRealHeight(1920 - 530),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                Radius = (uint)Application.GetRealHeight(50),
               // Radius = (uint)Application.GetRealHeight(60),
            };
            flMain.AddChidren(devicefra);
            devicefra.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight);
            var devicename = new Button
            #region  -------取消   完成
            var timetype = new RowLayout
            {
                Y = Application.GetRealHeight(20),
                Text = common.DeviceEpointName,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                Height = Application.GetRealHeight(150),
                Width = Application.GetRealWidth(1080 - 80),
                Height = Application.GetRealHeight(140),
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            devicefra.AddChidren(devicename);
            devicefra.AddChidren(timetype);
            var Btncancel = new Button
            {
                TextID = MyInternationalizationString.cancel,
                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                Height = Application.GetRealHeight(140),
                Width = Application.GetRealWidth(200),
                X = Application.GetRealWidth(80),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
            };
            timetype.AddChidren(Btncancel);
            Btncancel.MouseUpEventHandler += (sender16, e16) =>
            {
                flMain.RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
            };
            string SelectedDeviceStatuscondition = "no";
            var Btntitle = new Button
            {
                TextID = MyInternationalizationString.security,
                TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
                Height = Application.GetRealHeight(140),
                Width = Application.GetRealWidth(420),
                TextAlignment = TextAlignment.Center,
                X = Btncancel.Right + Application.GetRealWidth(50),
                TextSize = 16,
                Text = common.DeviceEpointName,
            };
            timetype.AddChidren(Btntitle);
            var Btncomplete = new Button
            {
                TextID = MyInternationalizationString.complete,
                TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
                Height = Application.GetRealHeight(140),
                Width = Application.GetRealWidth(200),
                TextAlignment = TextAlignment.CenterRight,
                X = Btntitle.Right + Application.GetRealWidth(50),
                TextSize = 14,
            if (deviceConditionsInfo.ContainsKey("Type"))
            {
                deviceConditionsInfo.Remove("Type");
            }
            if (deviceConditionsInfo.ContainsKey("IsValid"))
            {
                deviceConditionsInfo.Remove("IsValid");
            }
            if (deviceConditionsInfo.ContainsKey("MacAddr"))
            {
                deviceConditionsInfo.Remove("MacAddr");
            }
            if (deviceConditionsInfo.ContainsKey("Epoint"))
            {
                deviceConditionsInfo.Remove("Epoint");
            }
            deviceConditionsInfo.Add("Type", "1");
            deviceConditionsInfo.Add("IsValid", "1");
            deviceConditionsInfo.Add("MacAddr", common.DeviceAddr);
            deviceConditionsInfo.Add("Epoint",common.DeviceEpoint.ToString());
            };
            timetype.AddChidren(Btncomplete);
            #endregion
            string SelectedDeviceStatuscondition = "";
            Dictionary<string, string> devices = null;
            if (edit)
            {
@@ -452,101 +808,74 @@
                ///灯光
                case DeviceType.OnOffOutput:
                    {
                        if (deviceConditionsInfo.ContainsKey("Cluster_ID"))
                        {
                            deviceConditionsInfo.Remove("Cluster_ID");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeId"))
                        {
                            deviceConditionsInfo.Remove("AttriButeId");
                        }
                        if (deviceConditionsInfo.ContainsKey("Range"))
                        {
                            deviceConditionsInfo.Remove("Range");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeData2"))
                        {
                            deviceConditionsInfo.Remove("AttriButeData2");
                        }
                        deviceConditionsInfo.Add("Cluster_ID", "6");
                        deviceConditionsInfo.Add("AttriButeId", "0");
                        deviceConditionsInfo.Add("Range", "1");
                        deviceConditionsInfo.Add("AttriButeData2", "0");
                        dictionary(deviceConditionsInfo, "Cluster_ID", "6");
                        dictionary(deviceConditionsInfo, "AttriButeId", "0");
                        dictionary(deviceConditionsInfo, "Range", "1");
                        dictionary(deviceConditionsInfo, "AttriButeData2", "0");
                        #region  灯光View
                        devicefra.Y = Application.GetRealHeight(1920 - 30 - 720);
                        devicefra.Height = Application.GetRealHeight(720);
                        var OnOffOutputfra = new FrameLayout
                        var openframelayout = new FrameLayout
                        {
                            Y = Application.GetRealHeight(180),
                            Height = Application.GetRealHeight(180 * 2 + 30),
                            Height = Application.GetRealHeight(160),
                            Y = timetype.Bottom + Application.GetRealHeight(20),
                        };
                        devicefra.AddChidren(OnOffOutputfra);
                        devicefra.AddChidren(openframelayout);
                        var openrowlayout = new RowLayout
                        {
                            Height = Application.GetRealHeight(180),
                            Y = Application.GetRealHeight(30),
                            Width = Application.GetRealWidth(920),
                            Height = Application.GetRealHeight(130),
                            X = Application.GetRealWidth(80),
                            LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                        };
                        OnOffOutputfra.AddChidren(openrowlayout);
                        openframelayout.AddChidren(openrowlayout);
                        var btnopen = new Button
                        {
                            //Text = "开",
                            Width = Application.GetRealWidth(600),
                            TextID = MyInternationalizationString.open,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            //SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                            TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                            TextSize = 14,
                        };
                        openrowlayout.AddChidren(btnopen);
                        var openBtnSelected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        var openBtnSelected = new SelectedButton();
                        openrowlayout.AddChidren(openBtnSelected);
                        var closeframelayout = new FrameLayout
                        {
                            Height = Application.GetRealHeight(160),
                            Y = openframelayout.Bottom,
                        };
                        devicefra.AddChidren(closeframelayout);
                        var closerowlayout = new RowLayout
                        {
                            Y = openrowlayout.Bottom,
                            Height = Application.GetRealHeight(180),
                            Y = Application.GetRealHeight(30),
                            Width = Application.GetRealWidth(920),
                            Height = Application.GetRealHeight(130),
                            X = Application.GetRealWidth(80),
                            LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                        };
                        OnOffOutputfra.AddChidren(closerowlayout);
                        closeframelayout.AddChidren(closerowlayout);
                        var btnclose = new Button
                        {
                            //Text = "关",
                            TextID = MyInternationalizationString.close,
                            Width = Application.GetRealWidth(600),
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                            TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                            TextSize = 14,
                        };
                        closerowlayout.AddChidren(btnclose);
                        var closeBtnSelected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical,
                        };
                        var closeBtnSelected = new SelectedButton();
                        closerowlayout.AddChidren(closeBtnSelected);
                        #endregion
@@ -555,44 +884,47 @@
                        {
                            openBtnSelected.Visible = true;
                            closeBtnSelected.Visible = false;
                            SelectedDeviceStatuscondition = "yes";
                            if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                            {
                                deviceConditionsInfo.Remove("AttriButeData1");
                            }
                            deviceConditionsInfo.Add("AttriButeData1", "1");//默认值
                            btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            SelectedDeviceStatuscondition = "OnOffOutput";
                            dictionary(deviceConditionsInfo, "AttriButeData1", "1");//默认值
                        };
                        openrowlayout.MouseUpEventHandler += openclick;
                        btnopen.MouseUpEventHandler += openclick;
                        openBtnSelected.MouseUpEventHandler += openclick;
                        openframelayout.MouseUpEventHandler += openclick;
                        ///点击取消事件
                        EventHandler<MouseEventArgs> closeclick = (sender, e) =>
                        {
                            btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            openBtnSelected.Visible = false;
                            closeBtnSelected.Visible = true;
                            SelectedDeviceStatuscondition = "yes";
                            if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                            {
                                deviceConditionsInfo.Remove("AttriButeData1");
                            }
                            deviceConditionsInfo.Add("AttriButeData1", "0");//默认值
                            SelectedDeviceStatuscondition = "OnOffOutput";
                            dictionary(deviceConditionsInfo, "AttriButeData1", "0");//默认值
                        };
                        closerowlayout.MouseUpEventHandler += closeclick;
                        btnclose.MouseUpEventHandler += closeclick;
                        closeBtnSelected.MouseUpEventHandler += openclick;
                        closeBtnSelected.MouseUpEventHandler += closeclick;
                        closeframelayout.MouseUpEventHandler += closeclick;
                        if (edit && devices != null)
                        {
                            if (devices["AttriButeId"] == "0")
                            {
                                if (devices["AttriButeData1"] == "1")
                                {
                                    btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                    btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                    openBtnSelected.Visible = true;
                                    closeBtnSelected.Visible = false;
                                }
                                else
                                {
                                    btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                    btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                    openBtnSelected.Visible = false;
                                    closeBtnSelected.Visible = true;
@@ -604,29 +936,10 @@
                case DeviceType.WindowCoveringDevice:
                    {
                        if (deviceConditionsInfo.ContainsKey("Cluster_ID"))
                        {
                            deviceConditionsInfo.Remove("Cluster_ID");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeId"))
                        {
                            deviceConditionsInfo.Remove("AttriButeId");
                        }
                        if (deviceConditionsInfo.ContainsKey("Range"))
                        {
                            deviceConditionsInfo.Remove("Range");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeData2"))
                        {
                            deviceConditionsInfo.Remove("AttriButeData2");
                        }
                        deviceConditionsInfo.Add("Cluster_ID", "258");
                        deviceConditionsInfo.Add("AttriButeId", "8");
                        deviceConditionsInfo.Add("Range", "0");
                        deviceConditionsInfo.Add("AttriButeData2", "0");
                        dictionary(deviceConditionsInfo, "Cluster_ID", "258");
                        dictionary(deviceConditionsInfo, "AttriButeId", "8");
                        dictionary(deviceConditionsInfo, "Range", "0");
                        dictionary(deviceConditionsInfo, "AttriButeData2", "0");
                        #region 窗帘View
                        devicefra.Y = Application.GetRealHeight(1920 - 30 - 720);
@@ -649,11 +962,12 @@
                            //Text = "开",
                            TextID = MyInternationalizationString.open,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            X = Application.GetRealWidth(50),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            //SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                            TextSize = 14,
                        };
                        openrowlayout.AddChidren(btnopen);
@@ -680,10 +994,11 @@
                            //Text = "关",
                            TextID = MyInternationalizationString.close,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            X = Application.GetRealWidth(50),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                            TextSize = 14,
                        };
                        closerowlayout.AddChidren(btnclose);
@@ -702,15 +1017,10 @@
                        ///点击确认事件
                        EventHandler<MouseEventArgs> openclick = (sender, e) =>
                        {
                            SelectedDeviceStatuscondition = "yes";
                            SelectedDeviceStatuscondition = "WindowCoveringDevice";
                            openBtnSelected.Visible = true;
                            closeBtnSelected.Visible = false;
                            if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                            {
                                deviceConditionsInfo.Remove("AttriButeData1");
                            }
                            deviceConditionsInfo.Add("AttriButeData1", "95");//默认值
                            dictionary(deviceConditionsInfo, "AttriButeData1", "95");//默认值
                        };
                        openrowlayout.MouseUpEventHandler += openclick;
@@ -719,14 +1029,10 @@
                        ///点击取消事件
                        EventHandler<MouseEventArgs> closeclick = (sender, e) =>
                        {
                            SelectedDeviceStatuscondition = "yes";
                            SelectedDeviceStatuscondition = "WindowCoveringDevice";
                            openBtnSelected.Visible = false;
                            closeBtnSelected.Visible = true;
                            if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                            {
                                deviceConditionsInfo.Remove("AttriButeData1");
                            }
                            deviceConditionsInfo.Add("AttriButeData1", "5");//默认值
                            dictionary(deviceConditionsInfo, "AttriButeData1", "5");//默认值
                        };
                        closerowlayout.MouseUpEventHandler += closeclick;
@@ -759,141 +1065,128 @@
                        {
                            break;
                        }
                        if (deviceConditionsInfo.ContainsKey("Cluster_ID"))
                        {
                            deviceConditionsInfo.Remove("Cluster_ID");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeId"))
                        {
                            deviceConditionsInfo.Remove("AttriButeId");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeData2"))
                        {
                            deviceConditionsInfo.Remove("AttriButeData2");
                        }
                        deviceConditionsInfo.Add("Cluster_ID", "1280");
                        deviceConditionsInfo.Add("AttriButeId", "1281");
                        deviceConditionsInfo.Add("AttriButeData2", "0");
                        dictionary(deviceConditionsInfo, "Cluster_ID", "1280");
                        dictionary(deviceConditionsInfo, "AttriButeId", "1281");
                        dictionary(deviceConditionsInfo, "AttriButeData2", "0");
                        #region  安防设备View
                        devicefra.Y = Application.GetRealHeight(1920 - 30 - 720);
                        devicefra.Height = Application.GetRealHeight(720);
                        var iASZonedevicefra = new FrameLayout
                        var openframelayout = new FrameLayout
                        {
                            Y = Application.GetRealHeight(180),
                            Height = Application.GetRealHeight(180 * 2 + 30),
                            Height = Application.GetRealHeight(160),
                            Y = timetype.Bottom + Application.GetRealHeight(20),
                        };
                        devicefra.AddChidren(iASZonedevicefra);
                        devicefra.AddChidren(openframelayout);
                        var openrowlayout = new RowLayout
                        {
                            Height = Application.GetRealHeight(180),
                            Y = Application.GetRealHeight(30),
                            Width = Application.GetRealWidth(920),
                            Height = Application.GetRealHeight(130),
                            X = Application.GetRealWidth(80),
                            LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                        };
                        openframelayout.AddChidren(openrowlayout);
                        var btnopen = new Button
                        {
                            //TextID = MyInternationalizationString.open,
                            Width = Application.GetRealWidth(600),
                            TextID = MyInternationalizationString.open,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                            TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                            TextSize = 14,
                        };
                        openrowlayout.AddChidren(btnopen);
                        var openBtnSelected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        var openBtnSelected = new SelectedButton();
                        openrowlayout.AddChidren(openBtnSelected);
                        var closeframelayout = new FrameLayout
                        {
                            Height = Application.GetRealHeight(160),
                            Y = openframelayout.Bottom,
                        };
                        devicefra.AddChidren(closeframelayout);
                        var closerowlayout = new RowLayout
                        {
                            Height = Application.GetRealHeight(180),
                            Y = openrowlayout.Bottom,
                            Y = Application.GetRealHeight(30),
                            Width = Application.GetRealWidth(920),
                            Height = Application.GetRealHeight(130),
                            X = Application.GetRealWidth(80),
                            LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                        };
                        ///
                        closeframelayout.AddChidren(closerowlayout);
                        var btnclose = new Button
                        {
                            //TextID = MyInternationalizationString.close,
                            //Text = "关",
                            TextID = MyInternationalizationString.close,
                            Width = Application.GetRealWidth(600),
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                            TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                            TextSize = 14,
                        };
                        closerowlayout.AddChidren(btnclose);
                        var closeBtnSelected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        var closeBtnSelected = new SelectedButton();
                        closerowlayout.AddChidren(closeBtnSelected);
                        #endregion
                        int timevalue = 0;
                        ///点击确认事件
                        EventHandler<MouseEventArgs> openclick = (sender, e) =>
                        {
                            SelectedDeviceStatuscondition = "yes";
                            SelectedDeviceStatuscondition = "IASZone";
                            btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            openBtnSelected.Visible = true;
                            closeBtnSelected.Visible = false;
                            if (deviceConditionsInfo.ContainsKey("Range"))
                            if (iASZonedevice.IasDeviceType == 13)
                            {
                                deviceConditionsInfo.Remove("Range");
                                closeBtnSelected.Visible = true;
                            }
                            deviceConditionsInfo.Add("Range", "5");
                            if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                            {
                                deviceConditionsInfo.Remove("AttriButeData1");
                            }
                            deviceConditionsInfo.Add("AttriButeData1", "1");//默认值
                            dictionary(deviceConditionsInfo, "Range", "5");
                            dictionary(deviceConditionsInfo, "AttriButeData1", "1");
                        };
                        openrowlayout.MouseUpEventHandler += openclick;
                        btnopen.MouseUpEventHandler += openclick;
                        openBtnSelected.MouseUpEventHandler += openclick;
                        openframelayout.MouseUpEventHandler += openclick;
                        ///点击取消事件
                        EventHandler<MouseEventArgs> closeclick = (sender, e) =>
                        {
                            SelectedDeviceStatuscondition = "yes";
                            SelectedDeviceStatuscondition = "IASZone";
                            btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            openBtnSelected.Visible = false;
                            closeBtnSelected.Visible = true;
                            if (deviceConditionsInfo.ContainsKey("Range"))
                            dictionary(deviceConditionsInfo, "Range", "1");
                            dictionary(deviceConditionsInfo, "AttriButeData1", "0");
                            if (iASZonedevice.IasDeviceType == 13)
                            {
                                deviceConditionsInfo.Remove("Range");
                                SelectedDeviceStatuscondition = "";
                                btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                openBtnSelected.Visible = false;
                                closeBtnSelected.Visible = true;
                                var ignoreTime = new IgnoreTime();
                                UserView.HomePage.Instance.AddChidren(ignoreTime);
                                UserView.HomePage.Instance.PageIndex += 1;
                                ignoreTime.Show(common, btnclose.Text, edit, timevalue);
                            }
                            deviceConditionsInfo.Add("Range", "1");
                            if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                            {
                                deviceConditionsInfo.Remove("AttriButeData1");
                            }
                            deviceConditionsInfo.Add("AttriButeData1", "0");//默认值
                        };
                        closerowlayout.MouseUpEventHandler += closeclick;
                        btnclose.MouseUpEventHandler += closeclick;
                        closeBtnSelected.MouseUpEventHandler += closeclick;
                        closeframelayout.MouseUpEventHandler += closeclick;
@@ -902,63 +1195,138 @@
                            case 13:
                                {
                                    btnopen.TextID = MyInternationalizationString.someone;
                                    //btnclose.TextID = MyInternationalizationString.unmanned;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    //iASZonedevicefra.AddChidren(closerowlayout);
                                    btnclose.TextID = MyInternationalizationString.unattendedtime1;
                                    closeBtnSelected.UnSelectedImagePath = "ZigeeLogic/next.png";
                                    closeBtnSelected.Visible = true;
                                    openframelayout.AddChidren(openrowlayout);
                                    closeframelayout.AddChidren(closerowlayout);
                                }
                                break;
                            case 21:
                                {
                                    btnopen.TextID = MyInternationalizationString.logicopen;
                                    btnclose.TextID = MyInternationalizationString.logicclose;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    iASZonedevicefra.AddChidren(closerowlayout);
                                }
                                break;
                            case 22:
                                {
                                    #region
                                    devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 3 - 20 - 50);
                                    devicefra.Height = Application.GetRealHeight(140 + 160 * 3 + 20 + 50);
                                    btnopen.TextID = MyInternationalizationString.logicopen;
                                    btnclose.TextID = MyInternationalizationString.logicclose;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    iASZonedevicefra.AddChidren(closerowlayout);
                                    closerowlayout.LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor;
                                    openframelayout.AddChidren(openrowlayout);
                                    closeframelayout.AddChidren(closerowlayout);
                                    var timeoutframelayout = new FrameLayout
                                    {
                                        Height = Application.GetRealHeight(160),
                                        Y = closeframelayout.Bottom,
                                    };
                                    devicefra.AddChidren(timeoutframelayout);
                                    var timeoutrowlayout = new RowLayout
                                    {
                                        Y = Application.GetRealHeight(30),
                                        Width = Application.GetRealWidth(920),
                                        Height = Application.GetRealHeight(130),
                                        X = Application.GetRealWidth(80),
                                        LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                                    };
                                    timeoutframelayout.AddChidren(timeoutrowlayout);
                                    var btntimeout = new Button
                                    {
                                        TextID = MyInternationalizationString.closetimeout,
                                        Width = Application.GetRealWidth(600),
                                        TextAlignment = TextAlignment.CenterLeft,
                                        TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                                    };
                                    timeoutrowlayout.AddChidren(btntimeout);
                                    var timeoutBtnSelected = new Button
                                    {
                                        X = Application.GetRealWidth(860),
                                        Width = Application.GetMinRealAverage(60),
                                        Height = Application.GetMinRealAverage(60),
                                        UnSelectedImagePath = "ZigeeLogic/next.png",
                                        Gravity = Gravity.CenterVertical,
                                    };
                                    timeoutrowlayout.AddChidren(timeoutBtnSelected);
                                    EventHandler<MouseEventArgs> timeoutclick = (sender, e) =>
                                    {
                                        SelectedDeviceStatuscondition = "";
                                        btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                        btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                        openBtnSelected.Visible = false;
                                        closeBtnSelected.Visible = false;
                                        var ignoreTime = new IgnoreTime();
                                        UserView.HomePage.Instance.AddChidren(ignoreTime);
                                        UserView.HomePage.Instance.PageIndex += 1;
                                        ignoreTime.Show(common, btntimeout.Text, edit, timevalue);
                                    };
                                    timeoutframelayout.MouseUpEventHandler += timeoutclick;
                                    timeoutrowlayout.MouseUpEventHandler += timeoutclick;
                                    btntimeout.MouseUpEventHandler += timeoutclick;
                                    timeoutBtnSelected.MouseUpEventHandler += timeoutclick;
                                    #endregion
                                }
                                break;
                            case 40:
                                {
                                    devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
                                    devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50);
                                    btnopen.TextID = MyInternationalizationString.smokescreen;
                                    //btnclose.TextID = MyInternationalizationString.nosmokescreen;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    openframelayout.AddChidren(openrowlayout);
                                    openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                }
                                break;
                            case 42:
                                {
                                    btnopen.TextID = MyInternationalizationString.waterleakage;
                                    btnclose.TextID = MyInternationalizationString.noleakage;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    iASZonedevicefra.AddChidren(closerowlayout);
                                    openframelayout.AddChidren(openrowlayout);
                                    closeframelayout.AddChidren(closerowlayout);
                                }
                                break;
                            case 43:
                                {
                                    devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
                                    devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50);
                                    btnopen.TextID = MyInternationalizationString.gas;
                                    //btnclose.TextID = MyInternationalizationString.nogas;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    openframelayout.AddChidren(openrowlayout);
                                    openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                }
                                break;
                            case 44:
                                {
                                    devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
                                    devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50);
                                    btnopen.TextID = MyInternationalizationString.emergencybutton;
                                    //btnclose.TextID = MyInternationalizationString.nosmokescreen;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    openframelayout.AddChidren(openrowlayout);
                                    openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                }
                                break;
                            case 277:
                                {
                                    devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
                                    devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50);
                                    btnopen.TextID = MyInternationalizationString.callthepolice;
                                    //btnclose.TextID = MyInternationalizationString.nosmokescreen;
                                    iASZonedevicefra.AddChidren(openrowlayout);
                                    openframelayout.AddChidren(openrowlayout);
                                    openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                }
                                break;
                            default:
                                {
                                    devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
                                    devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50);
                                    btnopen.TextID = MyInternationalizationString.callthepolice;
                                    openframelayout.AddChidren(openrowlayout);
                                    openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                }
                                break;
                        }
@@ -968,392 +1336,210 @@
                            {
                                if (devices["AttriButeData1"] == "1")
                                {
                                    btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                    btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                    openBtnSelected.Visible = true;
                                    closeBtnSelected.Visible = false;
                                }
                                else
                                {
                                    openBtnSelected.Visible = false;
                                    closeBtnSelected.Visible = true;
                                    if (devices.ContainsKey("IgnoreTime"))
                                    {
                                        timevalue = int.Parse(devices["IgnoreTime"]);
                                    }
                                    else
                                    {
                                        btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                        btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                        openBtnSelected.Visible = false;
                                        closeBtnSelected.Visible = true;
                                    }
                                }
                            }
                        }
                    }
                    break;
                case DeviceType.OnOffSwitch:
                    {
                        if (deviceConditionsInfo.ContainsKey("Cluster_ID"))
                        {
                            deviceConditionsInfo.Remove("Cluster_ID");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeId"))
                        {
                            deviceConditionsInfo.Remove("AttriButeId");
                        }
                        if (deviceConditionsInfo.ContainsKey("Range"))
                        {
                            deviceConditionsInfo.Remove("Range");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeData1"))
                        {
                            deviceConditionsInfo.Remove("AttriButeData1");
                        }
                        if (deviceConditionsInfo.ContainsKey("AttriButeData2"))
                        {
                            deviceConditionsInfo.Remove("AttriButeData2");
                        }
                        deviceConditionsInfo.Add("Cluster_ID", "1282");
                        deviceConditionsInfo.Add("AttriButeId", "1283");
                        deviceConditionsInfo.Add("Range", "0");//按键特殊
                        deviceConditionsInfo.Add("AttriButeData1", "0");
                        deviceConditionsInfo.Add("AttriButeData2", "0");
                        devicefra.Y = Application.GetRealHeight(1920 - 30 - 720);
                        devicefra.Height = Application.GetRealHeight(720);
                        dictionary(deviceConditionsInfo, "Cluster_ID", "1282");
                        dictionary(deviceConditionsInfo, "AttriButeId", "1283");
                        dictionary(deviceConditionsInfo, "Range", "0");//按键特殊
                        dictionary(deviceConditionsInfo, "AttriButeData1", "0");
                        dictionary(deviceConditionsInfo, "AttriButeData2", "0");
                        devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
                        devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50);
                        var OnOffOutputfra = new FrameLayout
                        {
                            Y = Application.GetRealHeight(180),
                            Height = Application.GetRealHeight(180 * 2 + 30),
                            Height = Application.GetRealHeight(160),
                            Y = timetype.Bottom + Application.GetRealHeight(20),
                        };
                        devicefra.AddChidren(OnOffOutputfra);
                        var buttonRow = new RowLayout
                        {
                            Height = Application.GetRealHeight(180),
                            Y = Application.GetRealHeight(30),
                            Width = Application.GetRealWidth(920),
                            Height = Application.GetRealHeight(130),
                            X = Application.GetRealWidth(80),
                            LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                        };
                        OnOffOutputfra.AddChidren(buttonRow);
                        var button = new Button
                        {
                            //TextID = MyInternationalizationString.button1,
                            Width = Application.GetRealWidth(600),
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            Text=Language.StringByID(MyInternationalizationString.OnOffSwitch)+common.DeviceEpoint.ToString(),
                            TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
                            Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + common.DeviceEpoint.ToString(),
                            TextSize = 14,
                            //SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                        };
                        buttonRow.AddChidren(button);
                        var buttonSelected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        var buttonSelected = new SelectedButton();
                        buttonRow.AddChidren(buttonSelected);
                      EventHandler<MouseEventArgs> buttonclick = (sender, e) =>
                       {
                           buttonSelected.Visible = true;
                           SelectedDeviceStatuscondition = "yes";
                        EventHandler<MouseEventArgs> buttonclick = (sender, e) =>
                        {
                            buttonSelected.Visible = true;
                            SelectedDeviceStatuscondition = "OnOffSwitch";
                            button.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                       };
                        };
                        buttonRow.MouseUpEventHandler += buttonclick;
                        button.MouseUpEventHandler += buttonclick;
                        buttonSelected.MouseUpEventHandler += buttonclick;
                        OnOffOutputfra.MouseUpEventHandler += buttonclick;
                        if (edit && devices != null)
                        {
                            buttonSelected.Visible = true;
                            button.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                        }
                        /*
                        #region  按键View
                       #region ---button1---
                        devicefra.Y = Application.GetRealHeight(1920 - 30 - 720 - 360);
                        devicefra.Height = Application.GetRealHeight(720 + 360);
                        var OnOffOutputfra = new FrameLayout
                        {
                            Y = Application.GetRealHeight(180),
                            Height = Application.GetRealHeight(180 * 4 + 30),
                        };
                        devicefra.AddChidren(OnOffOutputfra);
                        var button1Row = new RowLayout
                        {
                            Height = Application.GetRealHeight(180),
                        };
                        OnOffOutputfra.AddChidren(button1Row);
                        var button1 = new Button
                        {
                            TextID = MyInternationalizationString.button1,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            //SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                        };
                        button1Row.AddChidren(button1);
                        var button1Selected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        button1Row.AddChidren(button1Selected);
                        #endregion
                        #region ---button2---
                        var button2Row = new RowLayout
                        {
                            Y = button1Row.Bottom,
                            Height = Application.GetRealHeight(180),
                        };
                        OnOffOutputfra.AddChidren(button2Row);
                        var button2 = new Button
                        {
                            TextID = MyInternationalizationString.button2,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                        };
                        button2Row.AddChidren(button2);
                        var button2Selected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical,
                        };
                        button2Row.AddChidren(button2Selected);
                        #endregion
                        #region ---button3---
                        var button3Row = new RowLayout
                        {
                            Y = button2Row.Bottom,
                            Height = Application.GetRealHeight(180),
                        };
                        OnOffOutputfra.AddChidren(button3Row);
                        var button3 = new Button
                        {
                            TextID = MyInternationalizationString.button3,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            //SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                        };
                        button3Row.AddChidren(button3);
                        var button3Selected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        button3Row.AddChidren(button3Selected);
                        #endregion
                        #region ---button4---
                        var button4Row = new RowLayout
                        {
                            Height = Application.GetRealHeight(180),
                            Y = button3Row.Bottom,
                        };
                        OnOffOutputfra.AddChidren(button4Row);
                        var button4 = new Button
                        {
                            TextID = MyInternationalizationString.button4,
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(40),
                            Width = Application.GetRealWidth(300),
                            Height = Application.GetRealHeight(180),
                            //SelectedBackgroundColor = 0xfffe5e00,
                            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                        };
                        button4Row.AddChidren(button4);
                        var button4Selected = new Button
                        {
                            X = Application.GetRealWidth(1000 - 150),
                            Width = Application.GetMinRealAverage(110),
                            Height = Application.GetMinRealAverage(110),
                            UnSelectedImagePath = "Item/YesSelected.png",
                            Visible = false,
                            Gravity = Gravity.CenterVertical
                        };
                        button4Row.AddChidren(button4Selected);
                        #endregion
                        #endregion
                        EventHandler<MouseEventArgs> button1click = (sender, e) =>
                        {
                            button1Selected.Visible = true;
                            button2Selected.Visible = false;
                            button3Selected.Visible = false;
                            button4Selected.Visible = false;
                            SelectedDeviceStatuscondition = "yes";
                            //默认值
                            if (deviceConditionsInfo.ContainsKey("Epoint"))
                            {
                                deviceConditionsInfo.Remove("Epoint");
                            }
                            deviceConditionsInfo.Add("Epoint", "1");
                        };
                        button1Row.MouseUpEventHandler += button1click;
                        button1.MouseUpEventHandler += button1click;
                        button1Selected.MouseUpEventHandler += button1click;
                        EventHandler<MouseEventArgs> button2click = (sender, e) =>
                        {
                            button1Selected.Visible = false;
                            button2Selected.Visible = true;
                            button3Selected.Visible = false;
                            button4Selected.Visible = false;
                            SelectedDeviceStatuscondition = "yes";
                            if (deviceConditionsInfo.ContainsKey("Epoint"))
                            {
                                deviceConditionsInfo.Remove("Epoint");
                            }
                            deviceConditionsInfo.Add("Epoint", "2");//默认值
                        };
                        button2Row.MouseUpEventHandler += button2click;
                        button2.MouseUpEventHandler += button2click;
                        button2Selected.MouseUpEventHandler += button2click;
                        EventHandler<MouseEventArgs> button3click = (sender, e) =>
                        {
                            button1Selected.Visible = false;
                            button2Selected.Visible = false;
                            button3Selected.Visible = true;
                            button4Selected.Visible = false;
                            SelectedDeviceStatuscondition = "yes";
                            if (deviceConditionsInfo.ContainsKey("Epoint"))
                            {
                                deviceConditionsInfo.Remove("Epoint");
                            }
                            deviceConditionsInfo.Add("Epoint", "3");//默认值
                        };
                        button3Row.MouseUpEventHandler += button3click;
                        button3.MouseUpEventHandler += button3click;
                        button3Selected.MouseUpEventHandler += button3click;
                        EventHandler<MouseEventArgs> button4click = (sender, e) =>
                        {
                            button1Selected.Visible = false;
                            button2Selected.Visible = false;
                            button3Selected.Visible = false;
                            button4Selected.Visible = true;
                            SelectedDeviceStatuscondition = "yes";
                            if (deviceConditionsInfo.ContainsKey("Epoint"))
                            {
                                deviceConditionsInfo.Remove("Epoint");
                            }
                            deviceConditionsInfo.Add("Epoint", "4");//默认值
                        };
                        button4Row.MouseUpEventHandler += button4click;
                        button4.MouseUpEventHandler += button4click;
                        button4Selected.MouseUpEventHandler += button4click;
                        if (edit && devices != null)
                        {
                            if (devices["Epoint"] == "1")
                            {
                                button1Selected.Visible = true;
                                button2Selected.Visible = false;
                                button3Selected.Visible = false;
                                button4Selected.Visible = false;
                            }
                            else if (devices["Epoint"] == "2")
                            {
                                button1Selected.Visible = false;
                                button2Selected.Visible = true;
                                button3Selected.Visible = false;
                                button4Selected.Visible = false;
                            }
                            else if (devices["Epoint"] == "3")
                            {
                                button1Selected.Visible = false;
                                button2Selected.Visible = false;
                                button3Selected.Visible = true;
                                button4Selected.Visible = false;
                            }
                            else if (devices["Epoint"] == "4")
                            {
                                button1Selected.Visible = false;
                                button2Selected.Visible = false;
                                button3Selected.Visible = false;
                                button4Selected.Visible = true;
                            }
                        }
                        */
                    }
                    break;
                case DeviceType.DoorLock:
                    {
                        flMain.RemoveFromParent();
                        var memberList = new MemberList();
                        UserView.HomePage.Instance.AddChidren(memberList);
                        UserView.HomePage.Instance.PageIndex += 1;
                        MemberList.edit = false;
                        memberList.Show(common);
                    }
                    break;
                case DeviceType.TemperatureSensor:
                    {
                        string current = Language.StringByID(MyInternationalizationString.current);
                        devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 2 - 20 - 50);
                        devicefra.Height = Application.GetRealHeight(140 + 160 * 2 + 20 + 50);
                        var temperatureSensor = common as TemperatureSensor;
                        var Btntemperaturevalue = new Button
                        {
                            TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                            Height = Application.GetRealHeight(60),
                            Width = Application.GetRealWidth(400),
                            TextAlignment = TextAlignment.CenterLeft,
                            X = Application.GetRealWidth(80),
                            Y = timetype.Bottom + Application.GetRealHeight(70),
                            TextSize = 14,
                        };
                        devicefra.AddChidren(Btntemperaturevalue);
                        var horizontalSeekBarVol = new HorizontalSeekBar
                        {
                            Width = Application.GetRealWidth(920),
                            Height = Application.GetRealHeight(80),
                            Radius = (uint)Application.GetRealHeight(25),
                            Y = timetype.Bottom + Application.GetRealHeight(70 + 60 + 70),
                            X = Application.GetRealWidth(80),
                            ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected,
                            Max = 100,
                            SleepTime = 1000,
                            ThumbRadius = 9,
                        };
                        devicefra.AddChidren(horizontalSeekBarVol);
                        horizontalSeekBarVol.MouseUpEventHandler += (sender, e) =>
                        {
                            SelectedDeviceStatuscondition = "TemperatureSensor";
                            if (temperatureSensor.SensorDiv == 1)
                            {
                                dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());
                                Btntemperaturevalue.Text = current + ">" + horizontalSeekBarVol.Progress.ToString() + "℃";
                            }
                            else
                            {
                                Btntemperaturevalue.Text = current + "<" + horizontalSeekBarVol.Progress.ToString() + "%";
                                dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());//温度值
                            }
                        };
                        if (temperatureSensor.SensorDiv == 1)
                        {
                            dictionary(deviceConditionsInfo, "Cluster_ID", "1026");
                            dictionary(deviceConditionsInfo, "AttriButeId", "0");
                            dictionary(deviceConditionsInfo, "Range", "0");//0大于AttriButeData1时触发动作
                            dictionary(deviceConditionsInfo, "AttriButeData1", "0");
                            dictionary(deviceConditionsInfo, "AttriButeData2", "0");
                            Btntemperaturevalue.Text = current + ">0℃";
                        }
                        else
                        {
                            Btntemperaturevalue.Text = current + "<0%";
                            dictionary(deviceConditionsInfo, "Cluster_ID", "1029");
                            dictionary(deviceConditionsInfo, "AttriButeId", "0");
                            dictionary(deviceConditionsInfo, "Range", "2");//2小于AttriButeData1时触发动作
                            dictionary(deviceConditionsInfo, "AttriButeData1", "0");//温度值
                            dictionary(deviceConditionsInfo, "AttriButeData2", "0");
                        }
                        if (edit && devices != null)
                        {
                            horizontalSeekBarVol.Progress = int.Parse(devices["AttriButeData1"]);
                            if (temperatureSensor.SensorDiv == 1)
                            {
                                Btntemperaturevalue.Text = current + ">" + devices["AttriButeData1"] + "℃";
                            }
                            else
                            {
                                Btntemperaturevalue.Text = current + "<" + devices["AttriButeData1"] + "%";
                            }
                        }
                    }
                    break;
            }
            var cancel = new Button
            {
                Height = Application.GetRealHeight(160),
                TextID = MyInternationalizationString.cancel,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextSize = 16,
                BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor,
                Y = devicefra.Height - Application.GetRealHeight(160),
            };
            devicefra.AddChidren(cancel);
            cancel.MouseUpEventHandler += (sender, e) =>
            {
                flMain.RemoveFromParent();
                UserView.HomePage.Instance.ScrollEnabled = true;
            };
            var btnSave = new Button
            {
                Y = Application.GetRealHeight(20),
                Width = Application.GetRealWidth(200),
                Height = Application.GetRealHeight(150),
                Text = Language.StringByID(MyInternationalizationString.complete),
                TextColor = ZigbeeColor.Current.LogicTextBlueColor,
                X = Application.GetRealWidth(1000 - 200),
            };
            devicefra.AddChidren(btnSave);
            btnSave.MouseUpEventHandler += (sender2, e2) =>
            Btncomplete.MouseUpEventHandler += (sender2, e2) =>
            {
                //UserView.HomePage.Instance.ScrollEnabled = true;
                if (SelectedDeviceStatuscondition == "yes")
                if (SelectedDeviceStatuscondition != "")
                {
                    LogicIfon.AddDeviceconditions(common, deviceConditionsInfo);
                }
                else
                {
                    var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
                                           Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
                                           Language.StringByID(MyInternationalizationString.complete));
                    alert.Show();
                    return;
                    if (!edit)
                    {
                        var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
                                               Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
                                               Language.StringByID(MyInternationalizationString.complete));
                        alert.Show();
                        return;
                    }
                }
                flMain.RemoveFromParent();
@@ -1367,6 +1553,16 @@
        }
        public static void dictionary(Dictionary<string, string> deviceConditionsInfo, string Key, string Value)
        {
            if (deviceConditionsInfo.ContainsKey(Key))
            {
                deviceConditionsInfo.Remove(Key);
            }
            deviceConditionsInfo.Add(Key, Value);
        }
    }
}