From 160e6863bf3ecb420986f31abb1ab1372218d921 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 11 一月 2021 14:11:35 +0800 Subject: [PATCH] Merge branch 'WJC' into NewFilePath --- HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 172 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs new file mode 100644 index 0000000..6020246 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/SpeciaTime.cs @@ -0,0 +1,172 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class SpeciaTime : FrameLayout + { + + public SpeciaTime() + { + Tag = "Logic"; + } + + public void Show(bool edit = false, int index = -1) + { + #region 鐣岄潰甯冨眬 + LogicView.TopView topView = new LogicView.TopView(); + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + topView.topNameBtn.TextID = StringId.selectionCondition; + + FrameLayout viewLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Width = Application.GetRealWidth(LogicView.TextSize.view375), + Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64), + 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(); + timeView.frameLayout.Y = Application.GetRealHeight(i * 50); + timeView.btnIcon.Visible = false; + 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]; + 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); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + } + + } + /// <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