From db68ee28e538f1de22db27216f194d131240f901 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 23 十一月 2020 17:46:30 +0800 Subject: [PATCH] 2020-11-23-1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 45 insertions(+), 8 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs index bbfe182..3db439e 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs @@ -12,7 +12,7 @@ public void Show() { - + #region 鐣岄潰甯冨眬 LogicView.TopView topView = new LogicView.TopView(); this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (e, sen) => @@ -49,17 +49,19 @@ timeHorizonView.btnText.TextID = StringId.timeHorizon; viewLayout.AddChidren(timeHorizonView.FLayoutView()); + #endregion + + #region 鏃堕棿鐐� 鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢 //鏃堕棿鐐圭偣鍑讳簨浠� timepointView.btnClick.MouseUpEventHandler += (sen, e) => { - //涓荤晫闈㈡帶浠� FrameLayout fLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; this.AddChidren(fLayout); - TimePoint(fLayout); + TimePoint(fLayout, false, 100); }; //鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢 @@ -72,15 +74,19 @@ }; //娣诲姞涓荤晫闈� this.AddChidren(fLayout); - TimeHorizon(fLayout,false,0); + TimeHorizon(fLayout, false, 0); }; + + #endregion } /// <summary> /// 鏃堕棿鐐规柟娉� /// </summary> /// <param name="fLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param> - public void TimePoint(FrameLayout fLayout) + /// <param name="edit">锛坱rue=缂栬緫锛沠alse=鏂板缓锛�</param> + /// <param name="index">缂栬緫鏉′欢鐨勭储寮�</param> + public void TimePoint(FrameLayout fLayout, bool edit, int index) { LogicView.TimeView timePointView = new LogicView.TimeView(); timePointView.FLayoutView(fLayout); @@ -98,6 +104,26 @@ timePointView.mUIPickerView.setCurrentItems(0, 30, 0); //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 string timepoint = "01:30"; + + if (edit) + { + Input inputs = Logic.currlogic.input[index]; + if (inputs.condition_type == "1") + { + List<Dictionary<string, string>> dicList = inputs.condition as List<Dictionary<string, string>>; + foreach (var dic in dicList) + { + string timeValue = dic["value"]; + int hIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GethIntList()); + int mIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList()); + //鏇存柊鍒濆鐘舵�� + timePointView.mUIPickerView.setCurrentItems(hIndex - 1, mIndex, 0); + timepoint = timeValue; + } + } + } + + //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => { @@ -117,8 +143,18 @@ LogicMethod.dictionary(dic, "data_type", "string"); LogicMethod.dictionary(dic, "value", timepoint); inputTime.condition.Add(dic); - //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢 - Logic.currlogic.input.Add(inputTime); + if (edit) + { + //绉婚櫎鏃ф暟鎹� + Logic.currlogic.input.RemoveAt(index); + //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�; + Logic.currlogic.input.Insert(index, inputTime); + } + else + { + //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢 + Logic.currlogic.input.Add(inputTime); + } RemoveViewByTag("Logic"); AddLogic addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); @@ -127,11 +163,12 @@ }; } - /// <summary> /// 鏃堕棿鑼冨洿鏂规硶 /// </summary> /// <param name="fLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param> + /// <param name="edit">锛坱rue=缂栬緫锛沠alse=鏂板缓锛�</param> + /// <param name="index">缂栬緫鏉′欢鐨勭储寮�</param> public void TimeHorizon(FrameLayout fLayout,bool edit,int index) { #region 鐣岄潰甯冨眬 -- Gitblit v1.8.0