| | |
| | | functionView.frameLayout.Y = Application.GetRealHeight(0); |
| | | } |
| | | |
| | | //场景 |
| | | 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 shiwaiView = new LogicView.SelectTypeView(); |
| | | shiwaiView.frameLayout.Y = functionView.frameLayout.Bottom; |
| | | shiwaiView.frameLayout.Y = sceneView.frameLayout.Bottom; |
| | | shiwaiView.btnText.TextID = StringId.shiwaibainhua; |
| | | shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; |
| | | |
| | |
| | | funTpye.Show(LogicMethod.condition_if); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | //场景点击事件 |
| | | sceneView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | SceneMethod(); |
| | | }; |
| | | //室外变化 |
| | | shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => { |
| | | Weather weather = new Weather(); |
| | |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加场景 |
| | | /// </summary> |
| | | public void SceneMethod() |
| | | { |
| | | var sceneList = LogicMethod.CurrLogicMethod.GetSceneList(); |
| | | List<string> nameList = new List<string>(); |
| | | for (int i = 0; i < sceneList.Count; i++) |
| | | { |
| | | var scene = sceneList[i]; |
| | | nameList.Add(scene.name); |
| | | } |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.FrameOrVv(this, nameList, new List<string> { }, StringId.addSceneLogic, (index) => |
| | | { |
| | | var sceneSelecetd = sceneList[index]; |
| | | Input input = new Input(); |
| | | input.sid = sceneSelecetd.sid; |
| | | input.condition_type = "10"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "scene"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", "on"); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input) |
| | | { |
| | | ///记录索引值 |
| | | int index = -1; |
| | | for (var i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | var condition_type = Logic.currlogic.input[i].condition_type; |
| | | if (condition_type == "10") |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | if (index != -1) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.input.RemoveAt(index); |
| | | //新数据插入旧数据的位置 |
| | | Logic.currlogic.input.Insert(index, input); |
| | | } |
| | | else |
| | | { |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | } |
| | | } |
| | | } |