From d297fddadd429ffffbeb3f623f5ad860c33b3e5a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 07 一月 2021 15:41:48 +0800
Subject: [PATCH] 20201-1-7-1

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs |  126 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 116 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs
index 51beb72..6020246 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs
@@ -3,15 +3,15 @@
 using System.Collections.Generic;
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
-    public class SpeciaTime:FrameLayout
+    public class SpeciaTime : FrameLayout
     {
-       
+
         public SpeciaTime()
         {
             Tag = "Logic";
         }
 
-        public void Show(bool edit=false, int index=-1)
+        public void Show(bool edit = false, int index = -1)
         {
             #region  鐣岄潰甯冨眬
             LogicView.TopView topView = new LogicView.TopView();
@@ -30,13 +30,30 @@
                 BackgroundColor = CSS.CSS_Color.viewMiddle,
             };
             this.AddChidren(viewLayout);
+            #endregion
 
+            //锛堟棩鍑烘椂锛屾棩钀芥椂锛屾鍗堟椂锛�
+            string str1 = "";
+            //锛堟彁鍓嶏紝寤舵椂锛�
+            string str2 = "";
+            //锛堟彁鍓嶏紝寤舵椂澶氬皯鍒嗛挓锛�
+            string value= "";
+            if (edit)
+            {
+                GetText(index, (s1, s2, s3) => {
+                    str1 = s1;
+                    str2 = s2;
+                    value = s3;
+                    
+                });
+
+               
+            }
             var list = new List<string> {
                 Language.StringByID(StringId.sunrise)+Language.StringByID(StringId.h),
                 Language.StringByID(StringId.sunset)+Language.StringByID(StringId.h),
                 Language.StringByID(StringId.at)+Language.StringByID(StringId.h),
             };
-
             for (int i = 0; i < list.Count; i++)
             {
                 LogicView.SelectTypeView timeView = new LogicView.SelectTypeView();
@@ -45,22 +62,111 @@
                 timeView.btnText.X = Application.GetRealWidth(16);
                 timeView.btnLine.X = Application.GetRealWidth(16);
                 timeView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
-                timeView.btnText.Text= list[i];
-                timeView.btnClick.Tag= list[i];
+                timeView.btnText.Text = list[i];
+                timeView.btnClick.Tag = list[i];
+                if (str1 == list[i])
+                {
+                    string s = "";
+                    if (value != "0")
+                    {
+                        if (value == "30")
+                        {
+                           s= str2 +value+ Language.StringByID(StringId.s);
+                        }
+                        else
+                        {
+                            s = str2 + value + Language.StringByID(StringId.minute);
+                        }
+                    }
+                    timeView.btnState.Visible = true;
+                    timeView.btnState.Text = s;
+                }
 
                 viewLayout.AddChidren(timeView.FLayoutView());
 
                 timeView.btnClick.MouseUpEventHandler += (sen, e) =>
                 {
-
                     Time3 time3 = new Time3();
                     MainPage.BasePageView.AddChidren(time3);
-                    time3.Show(timeView.btnClick.Tag.ToString(),edit,index);
+                    time3.Show(timeView.btnClick.Tag.ToString(), edit, index);
                     MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                 };
             }
-            #endregion
-           
+
         }
+        /// <summary>
+        /// 鑾蜂箣鍓嶇姸鎬佸��
+        /// </summary>
+        /// <param name="index"></param>
+        /// <param name="action"></param>
+        public void GetText(int index, Action<string, string, string> action) {
+            //锛堟棩鍑烘椂锛屾棩钀芥椂锛屾鍗堟椂锛�
+            string str1 = "";
+            //锛堟彁鍓嶏紝寤舵椂锛�
+            string str2 = "";
+            //锛堟彁鍓嶏紝寤舵椂澶氬皯鍒嗛挓锛�
+            string valuestr = "";
+            Input _input = Logic.currlogic.input[index];
+            if (_input.condition_type == "1")
+            {
+                var dicLists = _input.condition as List<Dictionary<string, string>>;
+                foreach (var dic in dicLists)
+                {
+                    string keyValue = dic["key"];
+                    valuestr = dic["value"];
+
+                    if (keyValue != "timepoint")
+                    {
+                        switch (keyValue)
+                        {
+                            case "before_sunrise":
+                                {
+                                    str1 = Language.StringByID(StringId.sunrise) + Language.StringByID(StringId.h);
+                                    str2 = Language.StringByID(StringId.advanced);
+
+                                }
+                                break;
+                            case "before_sunset":
+                                {
+
+                                    str1 = Language.StringByID(StringId.sunset) + Language.StringByID(StringId.h);
+                                    str2 = Language.StringByID(StringId.advanced);
+
+                                }
+                                break;
+                            case "before_noon":
+                                {
+                                    str1 = Language.StringByID(StringId.at) + Language.StringByID(StringId.h);
+                                    str2 = Language.StringByID(StringId.advanced);
+                                }
+                                break;
+                            case "after_sunrise":
+                                {
+                                    str1 = Language.StringByID(StringId.sunrise) + Language.StringByID(StringId.h);
+                                    str2 = Language.StringByID(StringId.delayLogic);
+                                }
+                                break;
+                            case "after_sunset":
+                                {
+                                    str1 = Language.StringByID(StringId.sunset) + Language.StringByID(StringId.h);
+                                    str2 = Language.StringByID(StringId.delayLogic);
+                                }
+                                break;
+                            case "after_noon":
+                                {
+                                    str1 = Language.StringByID(StringId.at) + Language.StringByID(StringId.h);
+                                    str2 = Language.StringByID(StringId.delayLogic);
+                                }
+                                break;
+                        }
+
+                    }
+
+                }
+
+            }
+            action(str1,str2, valuestr);
+        }
+       
     }
 }

--
Gitblit v1.8.0