From e87985ec1dcb69beedaf9f95e8e7aba14b7c08d6 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 09 十二月 2020 18:50:14 +0800
Subject: [PATCH] 2020-12-09 1.信息中心,增加下划线和点击Alter提醒详情。

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs |   64 +++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 14 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..14a41da 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,25 +74,29 @@
                 };
                 //娣诲姞涓荤晫闈�
                 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);
-            EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) =>
+            EventHandler<MouseEventArgs> removefLayout = (sender, e1) =>
              {
                 //绉婚櫎fLayout鐣岄潰
                 fLayout.RemoveFromParent();
              };
             //鍙栨秷鐐瑰嚮浜嬩欢
-            timePointView.btnCancel.MouseUpEventHandler += RemovefLayout;
+            timePointView.btnCancel.MouseUpEventHandler += removefLayout;
 
             //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩)
             timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null);
@@ -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