gxc
2019-12-17 96428beef8b714ddb163216de37ab59d31ff5aa7
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -249,7 +249,7 @@
                                        ac.DeviceStatusReport = common.DeviceStatusReport;
                                        foreach(var attList in attriButeList)
                                        {
                                            var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High || attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
                                            var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High && attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default;
                                            switch (attList.AttributeId)
                                            {
                                                case 0:
@@ -520,7 +520,7 @@
            functionBtn.Init();
            functionBtn.SetTitle(R.MyInternationalizationString.Function);
            //自动化
            automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20, 34, 150, 68);
            automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20+50, 34, 150, 68);
            automationBtn.Init();
            automationBtn.SetTitle(R.MyInternationalizationString.Automation);
            //隐藏自动化
@@ -859,7 +859,14 @@
                            }
                        }
                    }
                    foreach (var deviceUI in sameTypeList)
                    for (int i=0;i<sameTypeList.Count;i++)
                    {
                        var deviceUI = sameTypeList[i];
                        new System.Threading.Thread(() =>
                        {
                            Application.RunOnMainThread(() =>
                            {
                                try
                    {
                        //删除设备
                        EventHandler<MouseEventArgs> delEvent = (delSender, delE) =>
@@ -894,11 +901,11 @@
                        {
                            //灯
                            var light = deviceUI.CommonDevice as ToggleLight;
                            //补上非远程
                            if (light.Gateway == null)
                                        if (light.Gateway != null)
                            {
                                continue;
                            }
                                            new System.Threading.Thread(() =>
                                            {
                                                System.Threading.Thread.Sleep(100 * i);
                            if (light.Gateway.IsVirtual)
                            {
                                UserHomeView.ReadStatus(light, () =>
@@ -914,6 +921,8 @@
                                    ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice);
                                }
                            }
                                            })
                                            { IsBackground = true }.Start();
                            var deviceTypeRowLayout = new RowLayout()
                            {
@@ -996,7 +1005,7 @@
                                Tag = deviceUI,
                                Radius = 0
                            };
                            var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                            var delBtn = new CommonForm.RowLayoutDeleteButton()
                            {
                                Tag = deviceUI,
                                Radius = 0
@@ -1009,15 +1018,16 @@
                                delBtn.MouseUpEventHandler += delEvent;
                            }
                        }
                                    }
                        else if (deviceUI.CommonDevice.Type == DeviceType.AirSwitch)
                        {
                            //空气开关
                            var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
                            //补上非远程
                            if (airSwitch.Gateway == null)
                                        var airSwitch = deviceUI.CommonDevice as AirSwitch;
                                        if (airSwitch.Gateway != null)
                            {
                                continue;
                            }
                                            new System.Threading.Thread(() =>
                                            {
                                                System.Threading.Thread.Sleep(100 * i);
                            if (airSwitch.Gateway.IsVirtual)
                            {
                                UserHomeView.ReadStatus(airSwitch, () =>
@@ -1032,6 +1042,8 @@
                                    ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice);
                                }
                            }
                                            })
                                            { IsBackground = true }.Start();
                            var deviceTypeRowLayout = new RowLayout()
                            {
@@ -1096,7 +1108,7 @@
                                Tag = deviceUI,
                                Radius = 0
                            };
                            var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
                                            var delBtn = new CommonForm.RowLayoutDeleteButton()
                            {
                                Tag = deviceUI,
                                Radius = 0
@@ -1108,17 +1120,17 @@
                                deviceTypeRowLayout.AddRightView(delBtn);
                                delBtn.MouseUpEventHandler += delEvent;
                            }
                                        }
                        }
                        else if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight)
                        {
                            //调光灯
                            var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
                            //补上非远程
                            if (dimmableLight.Gateway == null)
                                        if (dimmableLight.Gateway != null)
                            {
                                continue;
                            }
                                            new System.Threading.Thread(() =>
                                            {
                                                System.Threading.Thread.Sleep(100 * i);
                            if (dimmableLight.Gateway.IsVirtual)
                            {
                                UserHomeView.ReadStatus(dimmableLight, () =>
@@ -1133,6 +1145,8 @@
                                    ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI.CommonDevice);
                                }
                            }
                                            })
                                            { IsBackground = true }.Start();
                            var deviceTypeRowLayout = new RowLayout()
                            {
@@ -1210,15 +1224,16 @@
                                delBtn.MouseUpEventHandler += delEvent;
                            }
                        }
                                    }
                        else if (deviceUI.CommonDevice.Type == DeviceType.Thermostat)
                        {
                            //空调
                            var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                            //补上非远程
                            if (ac.Gateway == null)
                                        if (ac.Gateway != null)
                            {
                                continue;
                            }
                                            new System.Threading.Thread(() =>
                                            {
                                                System.Threading.Thread.Sleep(100 * i);
                            if (ac.Gateway.IsVirtual)
                            {
                                //发送读取状态命令
@@ -1235,6 +1250,8 @@
                                    ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI.CommonDevice);
                                }
                            }
                                            })
                                            { IsBackground = true }.Start();
                            var deviceTypeRowLayout = new RowLayout()
                            {
@@ -1312,15 +1329,16 @@
                                acControl.Show(deviceUI, room);
                            };
                        }
                                    }
                        else if (deviceUI.CommonDevice.Type == DeviceType.WindowCoveringDevice)
                        {
                            //卷帘
                            var rollerShade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
                            //不上非远程
                            if (rollerShade.Gateway == null)
                                        if (rollerShade.Gateway != null)
                            {
                                continue;
                            }
                                            new System.Threading.Thread(() =>
                                            {
                                                System.Threading.Thread.Sleep(100 * i);
                            if (rollerShade.Gateway.IsVirtual)
                            {
                                UserHomeView.ReadStatus(rollerShade, () =>
@@ -1336,6 +1354,8 @@
                                    ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI.CommonDevice);
                                }
                            }
                                            })
                                            { IsBackground = true }.Start();
                            var deviceTypeRowLayout = new RowLayout()
                            {
@@ -1399,6 +1419,7 @@
                                rollerShadeControl.Show(deviceUI, room);
                            };
                        }
                                    }
                        else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock)
                        {
                            var deviceTypeRowLayout = new RowLayout()
@@ -1416,7 +1437,6 @@
                            deviceRow.SetStatuText(deviceUI.GetDeviceStatu());
                            deviceRow.HideSwitchBtn(true);
                            deviceTypeRowLayout.AddChidren(deviceRow);
                            deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
                            {
@@ -1477,6 +1497,14 @@
                            }
                        }
                    }
                                catch
                                {
                                }
                            });
                        })
                        { IsBackground=true}.Start();
                    }
                };
                foreach (var deviceType in Common.Room.GetdeviceTypes(room))