From 05cd80d1f3120f421008da69309a98708504be3f Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 十一月 2023 13:48:49 +0800 Subject: [PATCH] 2.4版本需求 --- HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 258 ++++++++++++++++++++++++++++---------------------- 1 files changed, 144 insertions(+), 114 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 84ea1a0..d0a06bd 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -17,119 +17,152 @@ /// </summary> public static void MainShow() { - automationPage.RemoveAll(); - VerticalRefreshLayout vv = new VerticalRefreshLayout(); - vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 - automationPage.AddChidren(vv); - vv.BeginHeaderRefreshingAction += () => + + System.Threading.Tasks.Task.Run(() => { - //娓呴櫎涔嬪墠鑷姩鍖栧垪琛�; - Logic.LogicList.Clear(); - //鑾峰彇鑷姩鍒楄〃 - GetLogicList(); - //鍒锋柊鑷姩鍖栫晫闈� - MainShow(); - //鍏抽棴鍒锋柊View锛� - vv.EndHeaderRefreshing(); - }; - //鑾峰彇鑷姩鍖栧垪琛� - GetLogicList(); - 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鍍忕礌 - vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); - LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); - vv.AddChidren(logicView.FLayoutView()); - logicView.btnLogicName.Text = currLogic.name; - logicView.btnWeekText.Text = GetCyclicText(currLogic); - logicView.btnclick.MouseUpEventHandler += (sen, e) => + try { - //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) => + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + } + catch { } + finally { - logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; - if (logicView.btnSwitchIcon.IsSelected) + Application.RunOnMainThread(() => { - logicView.btnSwitchIcon.IsSelected = true; - currLogic.enable = "true"; - } - else - { - logicView.btnSwitchIcon.IsSelected = false; - currLogic.enable = "false"; - } - new System.Threading.Thread(() => - { - try + + automationPage.RemoveAll(); + VerticalRefreshLayout vv = new VerticalRefreshLayout(); + vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 + automationPage.AddChidren(vv); + vv.BeginHeaderRefreshingAction += () => { - //閫昏緫浣胯兘鐨勫懡浠� - Send.Current.EnableLogic(currLogic); + System.Threading.Tasks.Task.Run(() => + { + try + { + //寮哄埗鏇存柊鑷姩鍖栧垪琛�; + Logic.LogicList.Clear(); + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + //鍒锋柊鑷姩鍖栫晫闈� + MainShow(); + //鍏抽棴鍒锋柊View锛� + vv.EndHeaderRefreshing(); + }); + } + + }); + + + }; + + for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪 + { + var currLogic = Logic.LogicList[i]; + ///涓婁笅闂撮殧12鍍忕礌 + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); + vv.AddChidren(logicView.FLayoutView()); + logicView.btnLogicName.Text = currLogic.name; + 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; + new MainView { }.SkipAddLogicPage(currLogic); + }; + //寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢 + logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => + { + logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; + if (logicView.btnSwitchIcon.IsSelected) + { + logicView.btnSwitchIcon.IsSelected = true; + currLogic.enable = "true"; + } + else + { + logicView.btnSwitchIcon.IsSelected = false; + currLogic.enable = "false"; + } + new System.Threading.Thread(() => + { + try + { + //閫昏緫浣胯兘鐨勫懡浠� + Send.Current.EnableLogic(currLogic); + + } + catch { } + + }) + { IsBackground = true }.Start(); + }; + + + GetSelectIcon(logicView.frameLayout, currLogic); + if (i == 0)//闄嶅簭鎺掑垪 + { + ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); + } + if (currLogic.enable == "true") + { + logicView.btnSwitchIcon.IsSelected = true; + } + else + { + logicView.btnSwitchIcon.IsSelected = false; + } + ///鏄剧ず鐗规畩鑷姩鍖栨爣蹇� + if (currLogic.tag == true) + { + logicView.btnIsDelTag.Visible = true; + } + else + { + logicView.btnIsDelTag.Visible = false; + } } - catch { } - }) - { IsBackground = true }.Start(); - }; + if (Logic.LogicList.Count == 0) + { + Button btnTipNot = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(120), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + automationPage.AddChidren(btnTipNot); + Button btnTipNotText = new Button() + { + Y = btnTipNot.Bottom + Application.GetRealHeight(16), + Height = Application.GetRealHeight(20), + TextID = StringId.logicnull, + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, + }; + automationPage.AddChidren(btnTipNotText); + } + }); + } + }); - GetSelectIcon(logicView.frameLayout, currLogic); - if (i == 0)//闄嶅簭鎺掑垪 - //if (Logic.LogicList.Count - 1 == i) - { - ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; - vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); - } - if (currLogic.enable == "true") - { - logicView.btnSwitchIcon.IsSelected = true; - } - else - { - logicView.btnSwitchIcon.IsSelected = false; - } - ///鏄剧ず鐗规畩鑷姩鍖栨爣蹇� - if (currLogic.tag == true) - { - logicView.btnIsDelTag.Visible = true; - } - else - { - logicView.btnIsDelTag.Visible = false; - } - } - - if (Logic.LogicList.Count == 0) - { - Button btnTipNot = new Button() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(120), - Width = Application.GetRealWidth(180), - Height = Application.GetRealWidth(180), - UnSelectedImagePath = "TipNot.png", - }; - automationPage.AddChidren(btnTipNot); - Button btnTipNotText = new Button() - { - Y = btnTipNot.Bottom + Application.GetRealHeight(16), - Height = Application.GetRealHeight(20), - TextID = StringId.logicnull, - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text14, - TextColor = CSS.CSS_Color.textConfirmColor, - }; - automationPage.AddChidren(btnTipNotText); - } } /// <summary> /// 鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉� @@ -265,13 +298,11 @@ //鑷姩鍖栧垪琛ㄤ负0鎵嶅幓鑾峰彇鑷姩鍖栧垪琛紱 return; } - List<string> logicIdList = new List<string>(); + var logicIdList = new List<string>(); //鑾峰彇閫昏緫ID鍒楄〃 - var idStr = Send.Current.GetLogicIdList(); - if (idStr != null) + var dateList = Send.Current.GetLogicIdList(); + if (dateList != null) { - var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); - var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); for (int i = 0; i < dateList.Count; i++) { //娣诲姞閫昏緫ID @@ -279,16 +310,15 @@ } } //鑾峰彇鑷姩鍖栧垪琛� - var logicListStr = Send.Current.GetLogic(logicIdList); - if (logicListStr != null) + var logicList = Send.Current.GetLogic(logicIdList); + if (logicList != null) { - var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString()); for (int j = 0; j < logicList.Count; j++) { var logic = logicList[j]; if (logic != null) { - //鏌ユ壘鏄惁宸茬粡瀛樺湪璇ラ�昏緫 + //鍘婚噸 var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); if (if_logic == null) { @@ -574,8 +604,8 @@ return false; } } - } - class LogicData + } + public class LogicIdData { /// <summary> /// 浜戠鍞竴id -- Gitblit v1.8.0