| | |
| | | viewLayout.AddChidren(functionView.FLayoutView()); |
| | | |
| | | //场景 |
| | | LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView(); |
| | | LogicView.SelectTypeView sceneView= new LogicView.SelectTypeView(); |
| | | sceneView.frameLayout.Y = functionView.frameLayout.Bottom; |
| | | sceneView.btnText.TextID = StringId.Scenes; |
| | | sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; |
| | | viewLayout.AddChidren(sceneView.FLayoutView()); |
| | | |
| | | //安防 |
| | | LogicView.SelectTypeView securityView = new LogicView.SelectTypeView(); |
| | | securityView.frameLayout.Y = sceneView.frameLayout.Bottom; |
| | | securityView.btnText.TextID = StringId.anfang; |
| | | securityView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png"; |
| | | viewLayout.AddChidren(securityView.FLayoutView()); |
| | | |
| | | //延时 |
| | | LogicView.SelectTypeView delayView = new LogicView.SelectTypeView(); |
| | |
| | | sceneView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | SceneMethod(); |
| | | }; |
| | | //安防点击事件 |
| | | securityView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | SecurityMethod(this); |
| | | }; |
| | | //延时点击事件 |
| | | delayView.btnClick.MouseUpEventHandler += (sen, e) => |
| | |
| | | nameList.Add(scene.name); |
| | | } |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.FrameOrVv(this, nameList, StringId.addSceneLogic, (index) => |
| | | publicInterface.FrameOrVv(this, nameList,new List<string> { }, StringId.addSceneLogic, (index) => |
| | | { |
| | | var sceneSelecetd = sceneList[index]; |
| | | Output outputDevice = new Output(); |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加安防 |
| | | /// </summary> |
| | | public void SecurityMethod(FrameLayout frameLayout, bool edit=false, int index1=-1) |
| | | { |
| | | List<string> stateList = new List<string>(); |
| | | if (edit&& index1 != -1) { |
| | | Output output = Logic.currlogic.output[index1]; |
| | | var security = LogicMethod.CurrLogicMethod.GetSecurity(output.sid); |
| | | stateList.Add(security.name); |
| | | } |
| | | var securityList = LogicMethod.CurrLogicMethod.GetSecurityList(); |
| | | List<string> nameList = new List<string>(); |
| | | for (int i = 0; i < securityList.Count; i++) |
| | | { |
| | | var security = securityList[i]; |
| | | nameList.Add(security.name); |
| | | } |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.FrameOrVv(frameLayout, nameList, stateList, StringId.addSecurityLogic,(index) => |
| | | { |
| | | var securitySelecetd = securityList[index]; |
| | | Output outputDevice = new Output(); |
| | | outputDevice.target_type = "3"; |
| | | outputDevice.sid = securitySelecetd.sid; |
| | | //没啥作用,为了发送数据格式统一; |
| | | outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", "0" } } }; |
| | | AddOutput(outputDevice,true); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 延时时间方法 |
| | | /// </summary> |
| | |
| | | if (edit) |
| | | { |
| | | Output output = Logic.currlogic.output[index]; |
| | | if (output.target_type == "3") |
| | | if (output.target_type == "4") |
| | | { |
| | | List<Dictionary<string, string>> dicList = output.status as List<Dictionary<string, string>>; |
| | | foreach (var dic in dicList) |
| | |
| | | } |
| | | Output outputTime= new Output(); |
| | | outputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | outputTime.target_type = "3"; |
| | | outputTime.target_type = "4"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint); |
| | |
| | | |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加目标 |
| | | /// </summary> |
| | | /// <param name="target"></param> |
| | | private void AddOutput(Output target) |
| | | /// <param name="bool_if">表示启用不同条件</param> |
| | | private void AddOutput(Output target,bool bool_if=false) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < Logic.currlogic.output.Count; i++) |
| | | { |
| | | if (Logic.currlogic.output[i].sid == target.sid) |
| | | if (bool_if) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | ///安防允许一种 |
| | | if (Logic.currlogic.output[i].target_type == target.target_type) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (Logic.currlogic.output[i].sid == target.sid) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (indexValue != -1) |
| | | { |
| | | Logic.currlogic.output.RemoveAt(indexValue); |