wxr
2021-01-11 160e6863bf3ecb420986f31abb1ab1372218d921
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
using 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);
        }
       
    }
}