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/LogicView/TimeView.cs | 196 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 155 insertions(+), 41 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 index ce25d88..a79324c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeView.cs @@ -15,16 +15,18 @@ Width = Application.GetRealWidth(343), X = Application.GetRealWidth(16), BackgroundColor = CSS.CSS_Color.view, - //Radius=(uint)Application.GetRealHeight(12), + Radius =(uint)Application.GetRealHeight(12), }; /// <summary> /// 鏃堕棿鎺т欢UIPickerView /// </summary> public UIPickerView mUIPickerView = new UIPickerView { + X= Application.GetRealWidth(12), Height = Application.GetRealHeight(297), - Width = Application.GetRealWidth(343), - BackgroundColor = CSS.CSS_Color.viewTranslucence, + Width = Application.GetRealWidth(343-12*2), + BackgroundColor =CSS.CSS_Color.viewTranslucence, + Radius = (uint)Application.GetRealHeight(12), }; /// <summary> @@ -38,7 +40,8 @@ Width = Application.GetRealWidth(52), Height = Application.GetRealHeight(32), Y = Application.GetRealHeight(6), - X = Application.GetRealWidth(8) + X = Application.GetRealWidth(8), + }; /// <summary> /// 纭畾Btn @@ -61,7 +64,8 @@ BackgroundColor = CSS.CSS_Color.viewLine, Width = Application.GetRealWidth(343), Height = 1, - Y = Application.GetRealWidth(44) + Y = Application.GetRealWidth(44), + }; /// <summary> /// 鏃堕棿View鐨勬柟娉� @@ -69,21 +73,135 @@ /// <returns></returns> public void FLayoutView(FrameLayout fLayout) { + + fLayout.AddChidren(frameLayout); frameLayout.AddChidren(mUIPickerView); frameLayout.AddChidren(btnCancel); frameLayout.AddChidren(btnConfirm); frameLayout.AddChidren(btnLine); - fLayout.AddChidren(frameLayout); } /// <summary> - /// 鑾峰彇24灏忔椂鍒楄〃 + /// 閫変腑鏃堕棿鐨勬柟娉� + /// </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灏忔椂鍒楄〃 /// </summary> /// <returns></returns> public List<string> GethStringList() { //鍒濆鍖栧垪琛� var hList = new List<string>(); - for (int i = 1; i < 24; i++) + for (int i = 0; i < 24; i++) + { + if (i < 10) + { + var a = "0" + i.ToString(); + //娣诲姞鏁版嵁 + hList.Add(a + " " + Language.StringByID(StringId.h)); + } + else + { + //娣诲姞鏁版嵁 + hList.Add(i.ToString() + " " + Language.StringByID(StringId.h)); + } + + } + return hList; + + + } + /// <summary> + /// 鑾峰彇0-23灏忔椂鍒楄〃 + /// </summary> + /// <returns></returns> + public List<string> GethStringList0() + { + //鍒濆鍖栧垪琛� + var hList = new List<string>(); + for (int i = 0; i < 24; i++) { if (i < 10) { @@ -128,16 +246,42 @@ return mList; } + /// <summary> + /// 鑾峰彇60绉掑垪琛� + /// </summary> + /// <returns></returns> + public List<string> GetsStringList() + { + //鍒濆鍖栧垪琛� + var mList = new List<string>(); + for (int i = 0; i < 60; i++) + { + if (i < 10) + { + var a = "0" + i.ToString(); + //娣诲姞鏁版嵁 + mList.Add(a + " " + Language.StringByID(StringId.s)); + } + else + { + //娣诲姞鏁版嵁 + mList.Add(i.ToString() + " " + Language.StringByID(StringId.s)); + } + + } + + return mList; + } /// <summary> - /// 鑾峰彇24灏忔椂鍒楄〃 + /// 鑾峰彇023灏忔椂鍒楄〃 /// </summary> /// <returns></returns> public List<int> GethIntList() { //鍒濆鍖栧垪琛� var hList = new List<int>(); - for (int i = 1; i < 24; i++) + for (int i = 0; i < 24; i++) { //娣诲姞鏁版嵁 hList.Add(i); @@ -146,6 +290,7 @@ } + /// <summary> /// 鑾峰彇60鍒嗛挓鍒楄〃 /// </summary> @@ -162,37 +307,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