From 0f2e0147e8990e913d16d99bc1b94fb6bc53abd7 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 03 十二月 2020 15:35:42 +0800
Subject: [PATCH] 2020-12-03-1

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs |   60 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 48 insertions(+), 12 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..634e7b0 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,9 +143,19 @@
                 LogicMethod.dictionary(dic, "data_type", "string");
                 LogicMethod.dictionary(dic, "value", timepoint);
                 inputTime.condition.Add(dic);
-                //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢
-                Logic.currlogic.input.Add(inputTime);
-                RemoveViewByTag("Logic");
+                if (edit)
+                {
+                    //绉婚櫎鏃ф暟鎹�
+                    Logic.currlogic.input.RemoveAt(index);
+                    //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
+                    Logic.currlogic.input.Insert(index, inputTime);
+                }
+                else
+                {
+                    //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢
+                    Logic.currlogic.input.Add(inputTime);
+                }
+                LogicMethod.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();
@@ -127,16 +163,16 @@
 
             };
         }
-
         /// <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 鐣岄潰甯冨眬
             LogicView.TimeHorizonView timeHorizonView = new LogicView.TimeHorizonView();
-            timeHorizonView.frameLayout.SetCornerWithSameRadius(12, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
             timeHorizonView.FLayoutView(fLayout);
             //寮�濮嬫椂闂�
             LogicView.SelectTypeView startTimeView = new LogicView.SelectTypeView();
@@ -163,7 +199,7 @@
 
             //缁撴潫鏃堕棿
             LogicView.SelectTypeView endTimeView = new LogicView.SelectTypeView();
-            endTimeView.frameLayout.SetCornerWithSameRadius(12, HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
+            endTimeView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
             endTimeView.frameLayout.Y = startTimeView.frameLayout.Bottom;
             endTimeView.btnIcon.Visible = false;
             endTimeView.btnLine.Visible = false;
@@ -243,7 +279,7 @@
                     //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢
                     Logic.currlogic.input.Add(inputTime);
                 }
-                RemoveViewByTag("Logic");
+                LogicMethod.RemoveAllView();
                 AddLogic addLogic = new AddLogic();
                 MainPage.BasePageView.AddChidren(addLogic);
                 addLogic.Show();

--
Gitblit v1.8.0