From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 27 八月 2021 13:21:21 +0800 Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs | 227 ++++++++++++++++++++++---------------------------------- 1 files changed, 88 insertions(+), 139 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs index 20a1887..ba94b4d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs @@ -36,17 +36,24 @@ 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(); delayView.frameLayout.Y = sceneView.frameLayout.Bottom; delayView.btnText.TextID = StringId.delayLogic; - delayView.btnIcon.UnSelectedImagePath = "LogicIcon/delayed.png"; + delayView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; //viewLayout.AddChidren(delayView.FLayoutView()); #endregion @@ -63,13 +70,17 @@ //鍦烘櫙鐐瑰嚮浜嬩欢 sceneView.btnClick.MouseUpEventHandler += (sen, e) => { + SceneMethod(); + }; + //瀹夐槻鐐瑰嚮浜嬩欢 + securityView.btnClick.MouseUpEventHandler += (sen, e) => + { + Security security = new Security(); + MainPage.BasePageView.AddChidren(security); + security.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - FrameLayout fLayout = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(fLayout); - SceneMethod(fLayout); + //SecurityMethod(this); }; //寤舵椂鐐瑰嚮浜嬩欢 delayView.btnClick.MouseUpEventHandler += (sen, e) => @@ -89,139 +100,66 @@ /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> - /// <param name="fLayout">寮规涓绘帶浠�</param> - public void SceneMethod(FrameLayout fLayout) + public void SceneMethod() { - int line = 0; - var sceneList = LogicMethod.GetSceneList(); - if (sceneList.Count == 0|| sceneList.Count>5) - { - line = 5; - } - else { - line = sceneList.Count; - } - LogicView.DateView view = new LogicView.DateView(); - view.btnTitle.TextID = StringId.addSceneLogic; - view.FLayoutView(fLayout, line); - - view.btnCancel.MouseUpEventHandler += (sender2, e2) => - { - fLayout.RemoveFromParent(); - }; - FrameLayout frameL = new FrameLayout - { - Y = Application.GetRealHeight(56), - Height = Application.GetRealHeight(50 * line), - }; - - VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout - { - Y = Application.GetRealHeight(56), - Height = Application.GetRealHeight(50 * 5), - - }; - verticalRefresh.BeginHeaderRefreshingAction += () => - { - //鍏抽棴鍒锋柊View锛� - verticalRefresh.EndHeaderRefreshing(); - }; - - if (sceneList.Count == 0) - { - Button btnTipNot = new Button - { - X=Application.GetRealWidth(93), - Y = Application.GetRealHeight(80), - Width = Application.GetRealWidth(158), - Height = Application.GetRealWidth(158), - UnSelectedImagePath = "TipNot.png", - - }; - view.frameLayout.AddChidren(btnTipNot); - - Button btnTipNotText = new Button() - { - Y = btnTipNot.Bottom+ Application.GetRealHeight(16), - Height = Application.GetRealHeight(20), - TextID = StringId.secnenull, - TextColor = CSS.CSS_Color.textColor, - TextSize =LogicView.TextSize.text14, - TextAlignment = TextAlignment.Center, - }; - view.frameLayout.AddChidren(btnTipNotText); - } - else if (sceneList.Count <=5 ) { - view.frameLayout.AddChidren(frameL); - } - else if(sceneList.Count>5) { - view.frameLayout.AddChidren(verticalRefresh); - - } - - - //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鐘舵�� - Button buttonClick = new Button(); - HDL_ON.Entity.Scene sceneSelecetd = null; - verticalRefresh.BeginHeaderRefreshingAction += () => - { - //鍏抽棴鍒锋柊View锛� - verticalRefresh.EndHeaderRefreshing(); - }; - - for (int i = 0; i < sceneList.Count; i++) - { + var sceneList = LogicMethod.CurrLogicMethod.GetSceneList(); + List<string> nameList = new List<string>(); + for (int i = 0; i < sceneList.Count; i++) { var scene = sceneList[i]; - LogicView.CheckView sceneView = new LogicView.CheckView(); - sceneView.btnText.Text = scene.name; - sceneView.btnText.TextSize = LogicView.TextSize.text14; - if (sceneList.Count <= 5) - { - sceneView.frameLayout.Y = Application.GetRealWidth(i*50); - frameL.AddChidren(sceneView.FLayoutView()); - if (sceneList.Count-1==i) { - sceneView.btnLine.BackgroundColor = CSS.CSS_Color.view; - } - } - else - { - verticalRefresh.AddChidren(sceneView.FLayoutView()); - } - sceneView.btnClick.Tag = scene;//鏍囪绱㈠紩 - //鍦烘櫙鐨勭偣鍑讳簨浠� - sceneView.btnClick.MouseUpEventHandler += (sender, e) => - { - buttonClick.IsSelected = false; - sceneView.btnCheckIcon.IsSelected = true; - buttonClick = sceneView.btnCheckIcon; - sceneSelecetd = sceneView.btnClick.Tag as HDL_ON.Entity.Scene; - }; - + nameList.Add(scene.name); } - //纭鐐瑰嚮浜嬩欢 - view.btnConfirm.MouseUpEventHandler += (sender1, e1) => + PublicInterface publicInterface = new PublicInterface(); + publicInterface.FrameOrVv(this, nameList,new List<string> { }, StringId.addSceneLogic, (index) => { - if (sceneSelecetd == null) - { - //鎻愮ず锛氳繕娌¢�変腑鎵ц鍛ㄦ湡 - return; - } + var sceneSelecetd = sceneList[index]; Output outputDevice = new Output(); outputDevice.target_type = "2"; outputDevice.sid = sceneSelecetd.sid; //娌″暐浣滅敤锛屼负浜嗗彂閫佹暟鎹牸寮忕粺涓�; - outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene"},{ "value", "0" } } }; + outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene" }, { "value", "0" } } }; AddOutput(outputDevice); - fLayout.RemoveFromParent(); - LogicMethod.RemoveAllView(); + LogicMethod.CurrLogicMethod.RemoveAllView(); AddLogic addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); 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> @@ -250,7 +188,7 @@ 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) @@ -281,11 +219,11 @@ return; } Output outputTime= new Output(); - outputTime.sid = LogicMethod.NewSid(); - outputTime.target_type = "3"; + outputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); + outputTime.target_type = "4"; Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "delay"); - LogicMethod.dictionary(dic, "value", timepoint); + LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay"); + LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint); outputTime.status.Add(dic); if (edit) { @@ -300,7 +238,7 @@ AddOutput(outputTime); } fLayout.RemoveFromParent(); - LogicMethod.RemoveAllView(); + LogicMethod.CurrLogicMethod.RemoveAllView(); AddLogic addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); @@ -308,23 +246,34 @@ }; } - /// <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); -- Gitblit v1.8.0