From 41f9c8837b0551c68f8fd798c06951fa716b7ab8 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 11 一月 2021 14:05:29 +0800 Subject: [PATCH] Merge branch 'NewFilePath' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into NewFilePath --- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs | 119 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 88 insertions(+), 31 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs old mode 100755 new mode 100644 index 0dce8c7..e199ffc --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs @@ -72,6 +72,7 @@ /// </summary> /// <returns></returns> public void FLayoutView(FrameLayout fLayout) + //public void FLayoutView(FrameLayout fLayout, string currState, Action<string> action) { fLayout.AddChidren(frameLayout); @@ -79,6 +80,93 @@ frameLayout.AddChidren(btnCancel); frameLayout.AddChidren(btnConfirm); frameLayout.AddChidren(btnLine); + //TimePoint(fLayout, action,currState); + } + /// <summary> + /// 閫変腑鏃堕棿鐨勬柟娉� + /// </summary> + /// <param name="fLayout">鐖舵帶浠�</param> + /// <param name="currState">涔嬪墠鐘舵�佸��</param> + /// <param name="action">杩斿洖鏃堕棿鍊�</param> + public void TimePoint(FrameLayout fLayout, string currState, Action<string> action) + { + //鍙栨秷鐐瑰嚮浜嬩欢 + btnCancel.MouseUpEventHandler += (sender, e1) => + { + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); + }; + //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩) + mUIPickerView.setNPicker(GethStringList(), GetmStringList(), null); + var systemHour = DateTime.Now.Hour; //鑾峰彇灏忔椂 + var systeMinute = DateTime.Now.Minute;//鑾峰彇鍒嗛挓 + int systemHourIndex = 0; + int systeMinuteIndex = 0; + for (int i = 0; i < GethIntList().Count; i++) + { + var currhour = GethIntList()[i]; + if (systemHour == currhour) + { + systemHourIndex = i; + break; + } + } + for (int i = 0; i < GetmIntList().Count; i++) + { + var currminute = GetmIntList()[i]; + if (systeMinute == currminute) + { + systeMinuteIndex = i; + break; + } + } + + //榛樿鍒濆閫変腑鐘舵�� + 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 (currState != "") + { + int hIndex = GetValueIndex(currState, 0, 1, GethIntList()); + int mIndex = GetValueIndex(currState, 1, 0, GetmIntList()); + //鏇存柊鍒濆鐘舵�� + mUIPickerView.setCurrentItems(hIndex, mIndex, 0); + timepoint = currState; + } + + //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� + mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => + { + string hour = GethStringList()[index1].Split(' ')[0]; + string minuet = GetmStringList()[index2].Split(' ')[0]; + timepoint = hour + ":" + minuet; + }; + //纭畾鐐瑰嚮浜嬩欢 + btnConfirm.MouseUpEventHandler += (sender, e3) => + { + action(timepoint); + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); + + }; } /// <summary> /// 鑾峰彇1-24灏忔椂鍒楄〃 @@ -195,37 +283,6 @@ return mList; } - /// <summary> - /// 杩斿洖鎸囧畾鍗曚綅鍒楄〃 - /// </summary> - /// <param name="min">鏈�灏忓��</param> - /// <param name="max">鏈�澶у��</param> - /// <param name="name">鍗曚綅(鏃讹紝鍒嗭紝绉�)</param> - /// <param name="digit">浣嶆暟(10浠ヤ笅鐢�(1浣嶈繕鏄�2浣�)鏄剧ず)</param> - /// <returns></returns> - public List<string> GetStringList(int min, int max, string name, int digit) - { - //鍒濆鍖栧垪琛� - var list = new List<string>(); - - for (int i = min; i < max; i++) - { - if (i < 10 && digit == 2) - { - var a = "0" + i.ToString(); - //娣诲姞鏁版嵁 - list.Add(a + " " + name); - } - else - { - //娣诲姞鏁版嵁 - list.Add(i.ToString() + " " + name); - } - - } - return list; - } - /// <summary> /// 鑾峰彇鏃堕棿鍊� /// </summary> -- Gitblit v1.8.0