| | |
| | | logicView.btnWeekText.Text = GetCyclicText(currLogic); |
| | | logicView.btnclick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | Logic.currlogic = currLogic; |
| | | var addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //Logic.currlogic = currLogic; |
| | | //var addLogic = new AddLogic(); |
| | | //MainPage.BasePageView.AddChidren(addLogic); |
| | | //addLogic.Show(); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | new MainView { }.SkipAddLogicPage(currLogic); |
| | | }; |
| | | //开关图标的点击事件 |
| | | logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => |
| | |
| | | /// <summary> |
| | | /// 按+跳转到逻辑界面的方法 |
| | | /// </summary> |
| | | public void SkipAddLogicPage() |
| | | public void SkipAddLogicPage(Logic logic=null) |
| | | { |
| | | Logic.currlogic = new Logic(); |
| | | var addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | if (logic == null) |
| | | { |
| | | Logic.currlogic = new Logic(); |
| | | } |
| | | else { |
| | | Logic.currlogic = logic; |
| | | } |
| | | if (IsGatewayType) |
| | | { |
| | | var addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | |
| | | var onePortAutomation = new OnePortAutomation(); |
| | | MainPage.BasePageView.AddChidren(onePortAutomation); |
| | | onePortAutomation.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | } |
| | | /// <summary> |
| | | ///返回循环描述文本 |
| | |
| | | } |
| | | return weekTextName.TrimEnd(','); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取每月的字符串 |
| | | /// </summary> |
| | |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | Console.WriteLine("获取逻辑==="+str); |
| | | var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); |
| | | if (logic != null) |
| | | { |
| | |
| | | if (if_logic == null) |
| | | { |
| | | |
| | | Logic newlogic = new Logic(); |
| | | newlogic.name = logic.name; |
| | | newlogic.userLogicId = logic.userLogicId; |
| | | newlogic.sid = logic.sid; |
| | | newlogic.relation = logic.relation; |
| | | newlogic.enable = logic.enable; |
| | | newlogic.cycle = logic.cycle; |
| | | for (int i = 0; i < logic.input.Count; i++) |
| | | { |
| | | if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type)) |
| | | { |
| | | //防止调试软件乱传东西上来; |
| | | //防止有空对象; |
| | | //正常情况下不会出现的现象; |
| | | continue; |
| | | } |
| | | newlogic.input.Add(logic.input[i]); |
| | | } |
| | | for (int i = 0; i < logic.output.Count; i++) |
| | | { |
| | | if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type)) |
| | | { |
| | | //防止调试软件乱传东西上来; |
| | | //防止有空对象; |
| | | //正常情况下不会该现象; |
| | | continue; |
| | | } |
| | | newlogic.output.Add(logic.output[i]); |
| | | } |
| | | //Logic newlogic = new Logic(); |
| | | //newlogic.name = logic.name; |
| | | //newlogic.userLogicId = logic.userLogicId; |
| | | //newlogic.sid = logic.sid; |
| | | //newlogic.relation = logic.relation; |
| | | //newlogic.enable = logic.enable; |
| | | //newlogic.cycle = logic.cycle; |
| | | //for (int i = 0; i < logic.input.Count; i++) |
| | | //{ |
| | | // if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type)) |
| | | // { |
| | | // //防止调试软件乱传东西上来; |
| | | // //防止有空对象; |
| | | // //正常情况下不会出现的现象; |
| | | // continue; |
| | | // } |
| | | // newlogic.input.Add(logic.input[i]); |
| | | //} |
| | | //for (int i = 0; i < logic.output.Count; i++) |
| | | //{ |
| | | // if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type)) |
| | | // { |
| | | // //防止调试软件乱传东西上来; |
| | | // //防止有空对象; |
| | | // //正常情况下不会该现象; |
| | | // continue; |
| | | // } |
| | | // newlogic.output.Add(logic.output[i]); |
| | | //} |
| | | |
| | | //添加逻辑 |
| | | Logic.LogicList.Add(newlogic); |
| | | Logic.LogicList.Add(logic); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示条件或者目标类型图标 |
| | | /// </summary> |
| | |
| | | case 3: |
| | | { |
| | | iconInt = 2; |
| | | |
| | | } |
| | | break; |
| | | case 4: |
| | | case 6: |
| | | case 9: |
| | | { |
| | | iconInt = 3; |
| | | |
| | | } |
| | | break; |
| | |
| | | strIcon = "LogicIcon/selectTheFun.png"; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | |
| | | strIcon = "LogicIcon/shiwaitianqi.png"; |
| | | } |
| | | break; |
| | | case 11: |
| | | { |
| | | //分割条件和目标的图标 |
| | |
| | | btnIcon.UnSelectedImagePath = strIcon; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 判断网关类型 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static bool IsGatewayType |
| | | { |
| | | get |
| | | { |
| | | if (Entity.DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | class LogicData |
| | | { |