陈嘉乐
2020-08-27 c7f2e3791f931d18c6ab3b1b215e57a1101e0389
ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -46,7 +46,7 @@
                {
                    ///区分出输入条件和输出目标设备
                    var listdevicetype = GetDevice(type);
                    var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype);
                    var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype, type);
                    if (listdevice.Count == 0)
                    {
                        ///过滤掉没有设备的房间
@@ -68,8 +68,9 @@
        /// </summary>
        /// <param name="room">当前房间</param>
        /// <param name="deviceTypelist">设备类型</param>
        ///  /// <param name="type">逻辑类型</param>
        /// <returns></returns>
        public static List<CommonDevice> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist)
        public static List<CommonDevice> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist,string type)
        {
            var deviceUIlist = new List<CommonDevice>();
            foreach (var deviceKey in room.ListDevice)
@@ -94,6 +95,22 @@
                        continue;
                    }
                }
                if (type == "condition_mould")
                {
                    if (device.Type == DeviceType.IASZone)
                    {
                        if (device.IasDeviceType != 13)
                        {//自动化模板只支持红外传感器
                            continue;
                        }
                        if (device.ModelIdentifier == "MSPIRB-ZB.10")
                        {
                            //自动化模板不支持光照度
                            continue;
                        }
                    }
                }
                deviceUIlist.Add(device);
            }
            return deviceUIlist;
@@ -108,7 +125,7 @@
            List<string> devicetypelist = new List<string>();
            devicetypelist.Clear();
            var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput);
            var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.ColorTemperatureLight);
            if (lightjosn != null)
            {
                devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights));
@@ -166,6 +183,7 @@
            {
                DeviceTypeList.Add(DeviceType.OnOffOutput);//0x0101十进制257
                DeviceTypeList.Add(DeviceType.DimmableLight);
                DeviceTypeList.Add(DeviceType.ColorTemperatureLight);
            }
            else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains))
            {
@@ -260,8 +278,17 @@
                        {
                            break;
                        }
                        patm = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
                        selectedpatm = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png";
                        if (device.ModelIdentifier == "MSPIRB-ZB.10")
                        {
                            patm = $"ZigeeLogic/sensor541.png";
                            selectedpatm = $"ZigeeLogic/selectedsensor541.png";
                        }
                        else
                        {
                            patm = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
                            selectedpatm = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png";
                        }
                    }
                    break;
                case DeviceType.TemperatureSensor:
@@ -316,6 +343,12 @@
                        selectedpatm = "ZigeeLogic/selectedairswitch.png";
                    }
                    break;
                case DeviceType.ColorTemperatureLight:
                    {
                        patm = "ZigeeLogic/nightLight.png";
                        selectedpatm = "ZigeeLogic/nightLightSelected.png";
                    }
                    break;
            }
            button.UnSelectedImagePath = patm;
            button.SelectedImagePath = selectedpatm;
@@ -350,6 +383,7 @@
                        deviceTypeList.Add(DeviceType.WindowCoveringDevice);
                        deviceTypeList.Add(DeviceType.Thermostat);
                        deviceTypeList.Add(DeviceType.AirSwitch);
                        deviceTypeList.Add(DeviceType.ColorTemperatureLight);
                        ///门锁特殊
                       // deviceTypeList.Add(DeviceType.DoorLock);
                    }
@@ -372,6 +406,7 @@
                        deviceTypeList.Add(DeviceType.WindowCoveringDevice);
                        deviceTypeList.Add(DeviceType.Thermostat);
                        deviceTypeList.Add(DeviceType.AirSwitch);
                        deviceTypeList.Add(DeviceType.ColorTemperatureLight);
                        ///门锁特殊
                      // deviceTypeList.Add(DeviceType.DoorLock);
                    }
@@ -833,7 +868,7 @@
                        }
                        if (LogicView.IfString._SoneLogic == if_logic)
                        {
                            //Sone门锁联动事件逻辑列表
                            //Sone门锁常开模式逻辑列表
                            Common.Logic.SoneLogicList.Add(CurrentLogic);
                        }
@@ -866,6 +901,30 @@
            UserView.HomePage.Instance.RemoveViewByTag("Logic");//移除所有标记Logic界面
            if (LogicView.IfString._Logic == if_logic)
            {
                //查询逻辑是否添加地理位置作为条件
                var exist = Common.Logic.CurrentLogic.Conditions.Find((obj) => obj["Type"] == "7");
                if (exist==null)
                {
                    //如果找不到地理位置作为条件的话,关闭GPS服务(减少耗电)
                    if (Send.It_Exist == "1")
                    {
                        //关闭GPS服务
                        Application.StopGPSLocationService();
                        //保存GPS服务关闭状态
                        Send.SaveLocalFile("GPS_File", "0");
                    }
                }
                else
                {
                    if (Send.It_Exist == "0")
                    {
                        //开启GPS服务
                        Application.StartGPSLocationService();
                        //保存GPS服务开启状态
                        Send.SaveLocalFile("GPS_File", "1");
                    }
                }
                //只刷新分类-自动化上下滑动view;
                Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
                // Category.Category.instance?.RefreshBodyView();
@@ -909,5 +968,8 @@
        /// 界面高度
        /// </summary>
        public static int H = 1922;
    }
}