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/MainView.cs | 210 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 160 insertions(+), 50 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 2497cbb..e933b09 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -9,7 +9,7 @@ public class MainView { /// <summary> - /// 璁板綍閫昏緫鑷姩鍖栫埗鎺т欢 + /// VerticalRefreshLayout鐖舵帶浠� /// </summary> public static FrameLayout automationPage; /// <summary> @@ -34,7 +34,7 @@ }; //鑾峰彇鑷姩鍖栧垪琛� GetLogicList(); - for (int i = Logic.LogicList.Count-1; i >= 0; i--)//闄嶅簭鎺掑垪 + for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪 //for (int i = 0; i < Logic.LogicList.Count; i++) { var currLogic = Logic.LogicList[i]; @@ -46,11 +46,12 @@ 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) => @@ -72,16 +73,16 @@ try { //閫昏緫浣胯兘鐨勫懡浠� - Send.switchLogic(currLogic); + Send.SwitchLogic(currLogic); } catch { } - + }) { IsBackground = true }.Start(); }; GetSelectIcon(logicView.frameLayout, currLogic); - if (i==0)//闄嶅簭鎺掑垪 + if (i == 0)//闄嶅簭鎺掑垪 //if (Logic.LogicList.Count - 1 == i) { ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; @@ -123,19 +124,36 @@ /// <summary> /// 鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉� /// </summary> - public static 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> ///杩斿洖寰幆鎻忚堪鏂囨湰 /// </summary> /// <param name="logic"></param> - public static string GetCyclicText(Logic logic) + public static string GetCyclicText(Logic logic) { string weekName = ""; @@ -209,7 +227,6 @@ } return weekTextName.TrimEnd(','); } - /// <summary> /// 鑾峰彇姣忔湀鐨勫瓧绗︿覆 /// </summary> @@ -240,11 +257,11 @@ } List<string> logicIdList = new List<string>(); //鑾峰彇閫昏緫ID鍒楄〃 - var idStr = Send.getLogicIdList(); + var idStr = Send.GetLogicIdList(); if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") { var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); - var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Date>>(date); + var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); for (int i = 0; i < dateList.Count; i++) { //娣诲姞閫昏緫ID @@ -252,7 +269,7 @@ } } //鑾峰彇鑷姩鍖栧垪琛� - var logicStr = Send.getLogic(logicIdList); + var logicStr = Send.GetLogic(logicIdList); if (logicStr.Code == "0" && logicStr.Data != null && logicStr.Data.ToString() != "") { //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�); @@ -269,8 +286,40 @@ var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); 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)) + { + //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵; + //闃叉鏈夌┖瀵硅薄锛� + //姝e父鎯呭喌涓嬩笉浼氬嚭鐜扮殑鐜拌薄锛� + 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)) + { + //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵; + //闃叉鏈夌┖瀵硅薄锛� + //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛� + continue; + } + newlogic.output.Add(logic.output[i]); + } + newlogic.noticeConfig = logic.noticeConfig; + newlogic.pushConfigs = logic.pushConfigs; //娣诲姞閫昏緫 - Logic.LogicList.Add(logic); + Logic.LogicList.Add(newlogic); } } @@ -293,12 +342,11 @@ } return false; } - /// <summary> /// 鏄剧ず鏉′欢鎴栬�呯洰鏍囩被鍨嬪浘鏍� /// </summary> /// <param name="layouFrame">鐖舵帶浠�</param> - /// <param name="logic">褰撳墠閫昏緫</param> + /// <param name="logic">褰撳墠鑷姩鍖�</param> private static void GetSelectIcon(FrameLayout layouFrame, Logic logic) { @@ -309,15 +357,12 @@ //1-10(琛ㄧず鏉′欢鍥炬爣)鑷繁灞�閮ㄥ畾涔変负浜嗘樉绀洪�変腑鏉′欢绫诲瀷鍥炬爣 //1-鏃堕棿鍥炬爣 //2-鍔熻兘鍥炬爣 + //3-浜戠鍥炬爣 + //4-鍦烘櫙鍥炬爣 for (int i = 0; i < logic.input.Count; i++) { if (logic.input[i] == null) - { - //闃叉鏈夌殑绌哄璞★紱 - //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛� continue; - } - var int1 = int.Parse(logic.input[i].condition_type); int iconInt = 0; switch (int1) @@ -332,6 +377,20 @@ case 3: { iconInt = 2; + + } + break; + case 4: + case 6: + case 9: + { + iconInt = 3; + + } + break; + case 10: + { + iconInt = 4; } break; @@ -350,15 +409,10 @@ //12-20(琛ㄧず鐩爣鍥炬爣)鑷繁灞�閮ㄥ畾涔変负浜嗘樉绀洪�変腑鐩爣绫诲瀷鍥炬爣 //12-鍔熻兘鍥炬爣 //13-鍦烘櫙鍥炬爣 + //14-瀹夐槻鍥炬爣 //14-寤舵椂鍥炬爣 for (int i = 0; i < logic.output.Count; i++) { - if (logic.output[i] == null) - { - //闃叉鏈夌殑绌哄璞★紱 - //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛� - continue; - } var int1 = int.Parse(logic.output[i].target_type); int iconInt = 0; switch (int1) @@ -381,6 +435,12 @@ } break; + case 4: + { + iconInt = 15; + + } + break; } if (!iconIntValue.Contains(iconInt)) @@ -389,10 +449,11 @@ } } //鍥炬爣鎺т欢鐨勭埗鎺т欢 - FrameLayout frame = new FrameLayout { - Height=Application.GetRealHeight(40), - Width=Application.GetRealWidth(275), - Y= Application.GetRealHeight(56), + FrameLayout frame = new FrameLayout + { + Height = Application.GetRealHeight(40), + Width = Application.GetRealWidth(275), + Y = Application.GetRealHeight(56), }; layouFrame.AddChidren(frame); @@ -404,7 +465,7 @@ { Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - Gravity=Gravity.CenterVertical, + Gravity = Gravity.CenterVertical, }; frame.AddChidren(btnIcon); @@ -414,12 +475,14 @@ } else { - btnIcon.X = Application.GetRealWidth(12+(28+4)*i); + btnIcon.X = Application.GetRealWidth(12 + (28 + 4) * i); } string strIcon = ""; - switch (iconIntValue[i]) { - - case 1: { + switch (iconIntValue[i]) + { + + case 1: + { strIcon = "LogicIcon/selectTheTime.png"; } break; @@ -429,22 +492,45 @@ strIcon = "LogicIcon/selectTheFun.png"; } break; + case 3: + { + + strIcon = "LogicIcon/shiwaitianqi.png"; + } + break; + case 4: + { + + strIcon = "LogicIcon/selectTheScene.png"; + } + break; case 11: { //鍒嗗壊鏉′欢鍜岀洰鏍囩殑鍥炬爣 strIcon = "LogicIcon/link.png"; - } break; + } + break; case 12: { strIcon = "LogicIcon/selectTheFun.png"; } break; - case 13: { + case 13: + { strIcon = "LogicIcon/selectTheScene.png"; - } break; - case 14: { + } + break; + case 14: + { + + strIcon = "LogicIcon/security.png"; + } + break; + case 15: + { //strIcon = "LogicIcon/timeicon.png"; + } break; @@ -452,19 +538,43 @@ btnIcon.UnSelectedImagePath = strIcon; } } + /// <summary> + /// 鍒ゆ柇缃戝叧绫诲瀷(0:bus缃戝叧锛�1:A鍗忚缃戝叧) + /// </summary> + /// <returns>true=A鍗忚缃戝叧;false=bus缃戝叧</returns> + public static bool IsGatewayType + { + get + { + if (Entity.DB_ResidenceData.Instance.GatewayType == 1) + { + return true; + } + return false; + } + } } - class Date + class LogicData { /// <summary> /// 浜戠鍞竴id /// </summary> - public string userLogicId = ""; + public string userLogicId = ""; + /// <summary> + /// 缃戝叧id + /// </summary> public string gatewayId = ""; /// <summary> /// 閫昏緫鍞竴鏍囪瘑 /// </summary> public string sid = ""; + /// <summary> + /// 閫昏緫鍚嶇О + /// </summary> public string name = ""; + /// <summary> + /// 閫昏緫浣胯兘锛堝紑锛屽叧锛� + /// </summary> public string enable = ""; //public CycleA cycle; //public string modifyTime = ""; -- Gitblit v1.8.0