| | |
| | | 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(); |
| | |
| | | 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.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); |
| | | } |
| | | |
| | | } |
| | | } |