| | |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | currLogic.enable = "false"; |
| | | } |
| | | //Send.switchLogic(currLogic); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | //逻辑使能的命令 |
| | | Send.SwitchLogic(currLogic); |
| | | Send.Current.EnableLogic(currLogic); |
| | | |
| | | } |
| | | catch { } |
| | |
| | | } |
| | | List<string> logicIdList = new List<string>(); |
| | | //获取逻辑ID列表 |
| | | var idStr = Send.GetLogicIdList(); |
| | | if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") |
| | | var idStr = Send.Current.GetLogicIdList(); |
| | | if (idStr != null) |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); |
| | |
| | | } |
| | | } |
| | | //获取自动化列表 |
| | | var logicStr = Send.GetLogic(logicIdList); |
| | | if (logicStr.Code == "0" && logicStr.Data != null && logicStr.Data.ToString() != "") |
| | | var logicListStr = Send.Current.GetLogic(logicIdList); |
| | | if (logicListStr != null) |
| | | { |
| | | //获取逻辑详细返回是一个数组(object类型转换为数组); |
| | | var jArray = JArray.Parse(logicStr.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString()); |
| | | for (int j = 0; j < logicList.Count; j++) |
| | | { |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); |
| | | var logic = logicList[j]; |
| | | if (logic != null) |
| | | { |
| | | //查找是否已经存在该逻辑 |
| | |
| | | //2-功能图标 |
| | | //3-云端图标 |
| | | //4-场景图标 |
| | | //5-地理围栏 |
| | | for (int i = 0; i < logic.input.Count; i++) |
| | | { |
| | | if (logic.input[i] == null) |
| | |
| | | |
| | | } |
| | | break; |
| | | case 8: |
| | | { |
| | | iconInt = 5; |
| | | |
| | | } |
| | | break; |
| | | case 10: |
| | | { |
| | | iconInt = 4; |
| | | |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | if (!iconIntValue.Contains(iconInt)) |
| | |
| | | strIcon = "LogicIcon/selectTheScene.png"; |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | |
| | | strIcon = "LogicIcon/selectlocation.png"; |
| | | } |
| | | break; |
| | | case 11: |
| | | { |
| | | //分割条件和目标的图标 |