From d72ca686a3e262693f8a6e45e747e8e8da43335b Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 06 七月 2021 09:39:03 +0800 Subject: [PATCH] 2021-07-06 1.更新 --- HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 126 ++++++++++++++++++++++++++++++------------ 1 files changed, 90 insertions(+), 36 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 2b375d9..fbfc392 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,8 +34,8 @@ }; //鑾峰彇鑷姩鍖栧垪琛� GetLogicList(); - // for (int i = Logic.LogicList.Count-1; i >= 0; i--)闄嶅簭鎺掑垪 - for (int i = 0; i < Logic.LogicList.Count; 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]; ///涓婁笅闂撮殧12鍍忕礌 @@ -43,7 +43,7 @@ LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); vv.AddChidren(logicView.FLayoutView()); logicView.btnLogicName.Text = currLogic.name; - logicView.btnWeekText.Text = GetWeekText(currLogic); + logicView.btnWeekText.Text = GetCyclicText(currLogic); logicView.btnclick.MouseUpEventHandler += (sen, e) => { Logic.currlogic = currLogic; @@ -52,6 +52,7 @@ addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; + //寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢 logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => { logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; @@ -59,20 +60,29 @@ { logicView.btnSwitchIcon.IsSelected = true; currLogic.enable = "true"; - - } else { logicView.btnSwitchIcon.IsSelected = false; currLogic.enable = "false"; } - Send.switchLogic(currLogic); + //Send.switchLogic(currLogic); + new System.Threading.Thread(() => + { + try + { + //閫昏緫浣胯兘鐨勫懡浠� + Send.SwitchLogic(currLogic); + } + catch { } + + }) + { IsBackground = true }.Start(); }; GetSelectIcon(logicView.frameLayout, currLogic); - //if (i==0)闄嶅簭鎺掑垪 - if (Logic.LogicList.Count - 1 == i) + if (i == 0)//闄嶅簭鎺掑垪 + //if (Logic.LogicList.Count - 1 == i) { ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); @@ -100,12 +110,12 @@ automationPage.AddChidren(btnTipNot); Button btnTipNotText = new Button() { - Y = btnTipNot.Bottom, - Height = Application.GetRealWidth(100), - TextID = StringId.TipNotOpen, + Y = btnTipNot.Bottom + Application.GetRealHeight(16), + Height = Application.GetRealHeight(20), + TextID = StringId.logicnull, TextAlignment = TextAlignment.Center, - TextColor = CSS.CSS_Color.TextualColor, - TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, + TextSize = LogicView.TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, }; automationPage.AddChidren(btnTipNotText); } @@ -125,7 +135,7 @@ ///杩斿洖寰幆鎻忚堪鏂囨湰 /// </summary> /// <param name="logic"></param> - public static string GetWeekText(Logic logic) + public static string GetCyclicText(Logic logic) { string weekName = ""; @@ -158,7 +168,7 @@ return weekName; } /// <summary> - /// 鑾峰彇鏄熸湡鐨勫瓧绗︿覆 + /// 杩斿洖鏄熸湡鎻忚堪鏂囨湰 /// </summary> /// <param name="weekList"></param> /// <returns></returns> @@ -200,7 +210,6 @@ return weekTextName.TrimEnd(','); } - /// <summary> /// 鑾峰彇姣忔湀鐨勫瓧绗︿覆 /// </summary> @@ -222,9 +231,8 @@ /// <summary> /// 鑾峰彇閫昏緫鍒楄〃 /// </summary> - private static void GetLogicList() + public static void GetLogicList() { - if (Logic.LogicList.Count != 0) { //鑷姩鍖栧垪琛ㄤ负0鎵嶅幓鑾峰彇鑷姩鍖栧垪琛紱 @@ -232,7 +240,7 @@ } 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); @@ -244,7 +252,7 @@ } } //鑾峰彇鑷姩鍖栧垪琛� - var logicStr = Send.getLogic(logicIdList); + var logicStr = Send.GetLogic(logicIdList); if (logicStr.Code == "0" && logicStr.Data != null && logicStr.Data.ToString() != "") { //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�); @@ -261,8 +269,38 @@ 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]); + } //娣诲姞閫昏緫 - Logic.LogicList.Add(logic); + Logic.LogicList.Add(newlogic); } } @@ -290,7 +328,7 @@ /// 鏄剧ず鏉′欢鎴栬�呯洰鏍囩被鍨嬪浘鏍� /// </summary> /// <param name="layouFrame">鐖舵帶浠�</param> - /// <param name="logic">褰撳墠閫昏緫</param> + /// <param name="logic">褰撳墠鑷姩鍖�</param> private static void GetSelectIcon(FrameLayout layouFrame, Logic logic) { @@ -369,10 +407,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); @@ -384,7 +423,7 @@ { Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - Gravity=Gravity.CenterVertical, + Gravity = Gravity.CenterVertical, }; frame.AddChidren(btnIcon); @@ -394,12 +433,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; @@ -413,17 +454,21 @@ { //鍒嗗壊鏉′欢鍜岀洰鏍囩殑鍥炬爣 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/timeicon.png"; } break; @@ -439,12 +484,21 @@ /// 浜戠鍞竴id /// </summary> 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