| | |
| | | /// <param name="device">Device.</param> |
| | | public static void RoomNmae(Button button, CommonDevice device) |
| | | { |
| | | button.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameByDevice(device); |
| | | button.Text = HdlRoomLogic.Current.GetRoomNameByDevice(device); |
| | | } |
| | | /// <summary> |
| | | /// 返回楼层所有的房间的列表 |
| | |
| | | public static List<Common.Room> GetRoomList(string type, string floorId = null) |
| | | { |
| | | var list = new List<Common.Room>(); |
| | | var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); |
| | | var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); |
| | | for (int i = 0; i < listAllRoom.Count; i++) |
| | | { |
| | | if (type == "action_logicscene" || type == "action_lockscene") |
| | |
| | | { |
| | | ///区分出输入条件和输出目标设备 |
| | | var listdevicetype = GetDevice(type); |
| | | var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype); |
| | | var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype, type); |
| | | if (listdevice.Count == 0) |
| | | { |
| | | ///过滤掉没有设备的房间 |
| | |
| | | /// </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) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(deviceKey); |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(deviceKey); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | |
| | | { |
| | | //过滤掉不支持的设备 |
| | | continue; |
| | | }
|
| | | if (device.Type == DeviceType.DoorLock)
|
| | | {
|
| | | var myInfo = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | if (myInfo.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone)
|
| | | {
|
| | | //暂时不支持S-one门锁;
|
| | | //过滤掉不支持S-one门锁设备;
|
| | | continue;
|
| | | } |
| | | if (device.Type == DeviceType.DoorLock) |
| | | { |
| | | var myInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | if (myInfo.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone) |
| | | { |
| | | //暂时不支持S-one门锁; |
| | | //过滤掉不支持S-one门锁设备; |
| | | 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); |
| | |
| | | { |
| | | 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: |
| | |
| | | }; break; |
| | | case 5: |
| | | { |
| | | string len = "", text = ""; |
| | | string len = ""; |
| | | string text = ""; |
| | | string weekStr = Language.StringByID(MyInternationalizationString.week1); |
| | | List<int> listvalueInt = new List<int>(); |
| | | listvalueInt.Clear(); |
| | | var maxvalue = Convert.ToString(currentLogic.TimeAttribute.WeekDay, 2); |
| | |
| | | if (strvalue == "1") |
| | | { |
| | | listvalueInt.Add(j + 1); |
| | | |
| | | |
| | | if ((j + 1) == 1) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.mon) + ","; |
| | | switch ((j + 1)) { |
| | | case 1: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.mon1) + ","; |
| | | } |
| | | break; |
| | | case 2: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.tue1) + ","; |
| | | } |
| | | break; |
| | | case 3: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.wed1) + ","; |
| | | } |
| | | break; |
| | | case 4: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.thu1) + ","; |
| | | } |
| | | break; |
| | | case 5: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.frl1) + ","; |
| | | } |
| | | break; |
| | | case 6: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.sat1) + ","; |
| | | } |
| | | break; |
| | | case 7: { |
| | | text += weekStr + Language.StringByID(MyInternationalizationString.sun1) + ","; |
| | | } |
| | | break; |
| | | } |
| | | else if ((j + 1) == 2) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.tue) + ","; |
| | | } |
| | | else if ((j + 1) == 3) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.wed) + ","; |
| | | } |
| | | else if ((j + 1) == 4) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.thu) + ","; |
| | | } |
| | | else if ((j + 1) == 5) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.frl) + ","; |
| | | } |
| | | else if ((j + 1) == 6) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.sat) + ","; |
| | | } |
| | | else if ((j + 1) == 7) |
| | | { |
| | | text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; |
| | | //text += Language.StringByID(MyInternationalizationString.sun) + ","; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | //{ |
| | | // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); |
| | | //} |
| | | button.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); |
| | | //btndisplaycycle.Text = text.TrimEnd(','); |
| | | button.Text = weekStr + text.Replace(weekStr, "").TrimEnd(','); |
| | | }; break; |
| | | } |
| | | |
| | |
| | | |
| | | if (CurrentLogic.Conditions.Count == 0 || CurrentLogic.Actions.Count == 0) |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | var alert = new ShowMsgControl(ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.addnull), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | |
| | | |
| | | if (string.IsNullOrEmpty(name)) |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | var alert = new ShowMsgControl(ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | |
| | | 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) |
| | | { |
| | | bool if_type = false; |
| | | //查询-逻辑列表-是否添加过地理位置作为条件 |
| | | for (int a = 0; a < Common.Logic.LogicList.Count; a++) |
| | | { |
| | | var logic = Common.Logic.LogicList[a]; |
| | | var exist_logic = logic.Conditions.Find((obj) => obj["Type"] == "7"); |
| | | if (exist_logic != null) |
| | | { |
| | | //是否存在地理位置条件 |
| | | if_type = true; |
| | | //退出for循环 |
| | | break; |
| | | } |
| | | } |
| | | if (if_type) |
| | | { |
| | | //查询之前状态是否已经开启GPS服务(以本地存储状态为主 0:没开启; 1:开启) |
| | | if (Send.If_Exist == "0") |
| | | { |
| | | //开启GPS服务 |
| | | Application.StartGPSLocationService(); |
| | | //保存GPS服务开启状态 |
| | | Send.SaveLocalFile(Config.Instance.HomeId + "_GPS_File", "1"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | //如果找不到地理位置作为条件的话,关闭GPS服务(减少耗电) |
| | | if (Send.If_Exist == "1") |
| | | { |
| | | //关闭GPS服务 |
| | | Application.StopGPSLocationService(); |
| | | //保存GPS服务关闭状态 |
| | | Send.SaveLocalFile(Config.Instance.HomeId + "_GPS_File", "0"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //查询之前状态是否已经开启GPS服务(以本地存储状态为主 0:没开启; 1:开启) |
| | | if (Send.If_Exist == "0") |
| | | { |
| | | //开启GPS服务 |
| | | Application.StartGPSLocationService(); |
| | | //保存GPS服务开启状态 |
| | | Send.SaveLocalFile(Config.Instance.HomeId + "_GPS_File", "1"); |
| | | } |
| | | } |
| | | //只刷新分类-自动化上下滑动view; |
| | | Phone.Category.CategoryMainForm.instance?.RefreshBodyView(); |
| | | // Category.Category.instance?.RefreshBodyView(); |
| | |
| | | /// 界面高度 |
| | | /// </summary> |
| | | public static int H = 1922; |
| | | |
| | | |
| | | |
| | | } |
| | | } |