From a35617eb62b317bf3ed92b1462018cf67c920411 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 15 十二月 2020 15:17:35 +0800 Subject: [PATCH] 2020-12-15-2 --- HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs | 46 ++++++++--- HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs | 130 ++++++++++++++++++++++++++----- .vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs | 5 4 files changed, 144 insertions(+), 37 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal index eaad541..53c3bc8 100644 --- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal Binary files differ diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs index fca082a..602a55d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs @@ -51,6 +51,7 @@ #endregion #region 鎵�鏈夌偣鍑讳簨浠� + //鍔熻兘鐐瑰嚮浜嬩欢 functionView.btnClick.MouseUpEventHandler += (sen, e) => { FunTpye funTpye = new FunTpye(); @@ -59,7 +60,7 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - + //鍦烘櫙鐐瑰嚮浜嬩欢 sceneView.btnClick.MouseUpEventHandler += (sen, e) => { @@ -70,7 +71,7 @@ this.AddChidren(fLayout); SceneMethod(fLayout); }; - + //寤舵椂鐐瑰嚮浜嬩欢 delayView.btnClick.MouseUpEventHandler += (sen, e) => { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs index 24724ca..213d4ad 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs @@ -95,21 +95,43 @@ EventHandler<MouseEventArgs> delClick = (sender, e) => { - + Loading loading = new Loading(); + this.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; new LogicView.TipPopView().TipBox(StringId.tip, StringId.delAutomation, () => { - var responsePackNew= Send.delLogic(Logic.currlogic); - if (responsePackNew.Code == "0") + loading.Start(); + new System.Threading.Thread(() => { - LogicMethod.RemoveAllView(); - Logic.LogicList.Remove(Logic.currlogic); - MainView.MainShow(); - //鍙戦�佸垹闄ら�昏緫鍛戒护锛� - } - else - { - new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); - } + try + { + //鍙戦�佸垹闄ら�昏緫鍛戒护锛� + responsePackNew = Send.delLogic(Logic.currlogic); + + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0") + { + LogicMethod.RemoveAllView(); + Logic.LogicList.Remove(Logic.currlogic); + MainView.MainShow(); + //鍙戦�佸垹闄ら�昏緫鍛戒护锛� + } + else + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); + } + }); + } + + }) + { IsBackground = true }.Start(); + }); }; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs index 39e5dae..56cdcc9 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs @@ -94,19 +94,60 @@ timePointView.FLayoutView(fLayout); EventHandler<MouseEventArgs> removefLayout = (sender, e1) => { - //绉婚櫎fLayout鐣岄潰 - fLayout.RemoveFromParent(); + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); }; //鍙栨秷鐐瑰嚮浜嬩欢 timePointView.btnCancel.MouseUpEventHandler += removefLayout; //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩) timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null); - //榛樿鍒濆閫変腑鐘舵�� - timePointView.mUIPickerView.setCurrentItems(0, 30, 0); - //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 - string timepoint = "01:30"; + var systemHour = DateTime.Now.Hour; //鑾峰彇灏忔椂 + var systeMinute = DateTime.Now.Minute;//鑾峰彇鍒嗛挓 + int systemHourIndex = 0; + int systeMinuteIndex = 0; + for (int i = 0; i < timePointView.GethIntList0().Count; i++) + { + var currhour = timePointView.GethIntList0()[i]; + if (systemHour == currhour) + { + systemHourIndex = i; + break; + } + } + for (int i = 0; i < timePointView.GetmIntList().Count; i++) + { + var currminute = timePointView.GetmIntList()[i]; + if (systeMinute == currminute) + { + systeMinuteIndex = i; + break; + } + } + + //榛樿鍒濆閫変腑鐘舵�� + timePointView.mUIPickerView.setCurrentItems(systemHourIndex, systeMinuteIndex, 0); + string currH = ""; + string currM = ""; + if (systemHour < 10) + { + currH = "0" + systemHour.ToString(); + } + else + { + currH = systemHour.ToString(); + } + if (systeMinute < 10) + { + currM = "0" + systeMinute.ToString(); + } + else + { + currM = systeMinute.ToString(); + } + //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 + string timepoint = currH + ":" + currM; if (edit) { Input inputs = Logic.currlogic.input[index]; @@ -124,7 +165,6 @@ } } } - //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => @@ -171,7 +211,7 @@ /// <param name="fLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param> /// <param name="edit">锛坱rue=缂栬緫锛沠alse=鏂板缓锛�</param> /// <param name="index">缂栬緫鏉′欢鐨勭储寮�</param> - public void TimeHorizon(FrameLayout fLayout,bool edit,int index) + public void TimeHorizon(FrameLayout fLayout, bool edit, int index) { #region 鐣岄潰甯冨眬 LogicView.TimeHorizonView timeHorizonView = new LogicView.TimeHorizonView(); @@ -226,15 +266,19 @@ #region 鐐瑰嚮浜嬩欢 //寮�濮嬫椂闂寸偣鍑讳簨浠� - startTimeView.btnClick.MouseUpEventHandler += (sender, e) => - { + EventHandler<MouseEventArgs> StartTimeClick = (sender,e) => { SelectedTimeHorizon(fLayout, btnStartTimeText); }; + startTimeView.btnClick.MouseUpEventHandler += StartTimeClick; + btnStartTimeText.MouseUpEventHandler += StartTimeClick; //缁撴潫鏃堕棿鐐瑰嚮浜嬩欢 - endTimeView.btnClick.MouseUpEventHandler += (sender, e) => - { + EventHandler<MouseEventArgs> EndTimeClick = (sender, e) => { SelectedTimeHorizon(fLayout, btnEndTimeText); }; + endTimeView.btnClick.MouseUpEventHandler += EndTimeClick; + btnEndTimeText.MouseUpEventHandler += EndTimeClick; + + //纭畾鐐瑰嚮浜嬩欢 timeHorizonView.btnConfirm.MouseUpEventHandler += (sender, e) => { @@ -266,7 +310,7 @@ LogicMethod.dictionary(dic, "key", "timesection"); LogicMethod.dictionary(dic, "comparator", "="); LogicMethod.dictionary(dic, "data_type", "string"); - LogicMethod.dictionary(dic, "value", btnStartTimeText.Text+"~"+btnEndTimeText.Text); + LogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "~" + btnEndTimeText.Text); inputTime.condition.Add(dic); if (edit) { @@ -329,11 +373,53 @@ timePointView.btnCancel.MouseUpEventHandler += RemovefLayout; //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩) timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null); + + var systemHour = DateTime.Now.Hour; //鑾峰彇灏忔椂 + var systeMinute = DateTime.Now.Minute;//鑾峰彇鍒嗛挓 + int systemHourIndex = 0; + int systeMinuteIndex = 0; + for (int i = 0; i < timePointView.GethIntList0().Count; i++) + { + var currhour = timePointView.GethIntList0()[i]; + if (systemHour == currhour) + { + systemHourIndex = i; + break; + } + } + for (int i = 0; i < timePointView.GetmIntList().Count; i++) + { + var currminute = timePointView.GetmIntList()[i]; + if (systeMinute == currminute) + { + systeMinuteIndex = i; + break; + } + } + //榛樿鍒濆閫変腑鐘舵�� - timePointView.mUIPickerView.setCurrentItems(0, 30, 0); + timePointView.mUIPickerView.setCurrentItems(systemHourIndex, systeMinuteIndex, 0); + string currH = ""; + string currM = ""; + if (systemHour < 10) + { + currH = "0" + systemHour.ToString(); + } + else + { + currH = systemHour.ToString(); + } + if (systeMinute < 10) + { + currM = "0" + systeMinute.ToString(); + } + else + { + currM = systeMinute.ToString(); + } //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 - string timepoint = "01:30"; - int sumTime = 90; + string timepoint = currH + ":" + currM; + int sumTime = systemHour*60+ systeMinute; if (btn.Tag.ToString() != "0") { @@ -367,7 +453,7 @@ //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => { - + string hour = timePointView.GethStringList()[index1].Split(' ')[0]; string minuet = timePointView.GetmStringList()[index2].Split(' ')[0]; timepoint = hour + ":" + minuet; @@ -384,8 +470,6 @@ timePointView.frameLayout.RemoveFromParent(); }; } - - /// <summary> /// 鐏拌壊寮规鐖舵帶浠� /// </summary> @@ -401,16 +485,16 @@ fra.RemoveFromParent(); } } - - + + FrameLayout fLayout = new FrameLayout() { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - + }; frame.AddChidren(fLayout); - + return fLayout; } } -- Gitblit v1.8.0