gxc
2019-10-28 1c4904d77f484c075080942d87785481b52b6fb2
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using ZigBee.Device;
 
namespace Shared.Phone.UserCenter.DevicePirSensor
{
    /// <summary>
    /// PIR传感器的灯光特效配置界面★
    /// </summary>
    public class PirSensorLightSettionForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 列表控件
        /// </summary>
        private VerticalScrolViewLayout listView = null;
        /// <summary>
        /// 传感器设备
        /// </summary>
        private IASZone deviceIASZone = null;
        /// <summary>
        /// 灯光的配置
        /// </summary>
        private IASZone.ConfigureParamates Lightconfigure = null;
        /// <summary>
        /// 【自动关灯】行
        /// </summary>
        //private RowSecondRightTextView btnAutoStatu = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_iasZone">传感器设备</param>
        public void ShowForm(IASZone i_iasZone)
        {
            deviceIASZone = i_iasZone;
 
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uLightSettion));
 
            //初始化中部信息
            //this.InitMiddleFrame();
        }
 
        ///// <summary>
        ///// 初始化中部信息
        ///// </summary>
        //private void InitMiddleFrame()
        //{
        //    //清空bodyFrame
        //    this.ClearBodyFrame();
 
        //    this.listView = new VerticalScrolViewLayout();
        //    this.listView.Height = bodyFrameLayout.Height;
        //    bodyFrameLayout.AddChidren(this.listView);
 
        //    //添加【自动关灯】行
        //    this.btnAutoStatu = this.AddAutoCloseLightRow();
        //    //添加【光感调节】行
        //    this.AddAutoAdjustLightRow();
 
        //    //用线程设置灯光的配置信息
        //    this.SetLightSettionData();
        //}
 
        #endregion
 
        //#region ■ 自动关灯___________________________
 
        ///// <summary>
        ///// 添加【自动关灯】行
        ///// </summary>
        ///// <returns></returns>
        //private RowSecondRightTextView AddAutoCloseLightRow()
        //{
        //    var row = new StatuRowLayout(listView);
        //    //自动关灯
        //    var btnLight = new RowTopBlackView(false);
        //    btnLight.TextID = R.MyInternationalizationString.uAutoCloseLight;
        //    row.AddChidren(btnLight);
        //    //设置人离开后灯光关闭的时间
        //    var btnMsg = new RowBottomGrayView(false);
        //    btnMsg.TextID = R.MyInternationalizationString.uSetLightCloseTimeByPersoinLeave;
        //    row.AddChidren(btnMsg);
 
        //    //状态
        //    var btnStatu = new RowSecondRightTextView();
        //    btnStatu.TextColor = UserCenterColor.Current.Gray;
        //    row.AddChidren(btnStatu);
 
        //    row.AddRightArrow();
 
        //    row.MouseUpEvent += (sender, e) =>
        //    {
        //        List<string> list = new List<string>();
        //        string second = Language.StringByID(R.MyInternationalizationString.Second);
        //        list.Add("3 " + second);
        //        for (int i = 5; i <= 120; i = i + 5)
        //        {
        //            list.Add(i + " " + second);
        //        }
        //        PickerView.Show(list, this.AutoCloseLightSelectAction);
        //    };
        //    return btnStatu;
        //}
 
        ///// <summary>
        ///// 自动关灯的选择Action事件
        ///// </summary>
        ///// <param name="value"></param>
        //private async void AutoCloseLightSelectAction(string value)
        //{
        //    if (this.Lightconfigure == null)
        //    {
        //        //重新获取
        //        this.Lightconfigure = await HdlPirSensorLogic.Current.GetPirSensorLightSettion(deviceIASZone);
        //        if (this.Lightconfigure == null)
        //        {
        //            return;
        //        }
        //    }
        //    string second = Language.StringByID(R.MyInternationalizationString.Second);
        //    int spaceTime = Convert.ToInt32(value.Replace(second, string.Empty).Trim());
        //    //保存传感器的灯光的配置信息
        //    var result = await this.SaveLightSettionData(spaceTime, this.Lightconfigure.levelSize);
        //}
 
        //#endregion
 
        //#region ■ 光感调节___________________________
 
        ///// <summary>
        ///// 添加【光感调节】行
        ///// </summary>
        ///// <returns></returns>
        //private void AddAutoAdjustLightRow()
        //{
        //    var row = new StatuRowLayout(listView);
        //    //光感调节
        //    var btnLight = new RowTopBlackView(false);
        //    btnLight.TextID = R.MyInternationalizationString.uLightPerceptionRegulation;
        //    row.AddChidren(btnLight);
        //    //根据环境照度自动开启灯光
        //    var btnMsg = new RowBottomGrayView(false);
        //    btnMsg.TextID = R.MyInternationalizationString.uAutoOpenLightByLevel;
        //    row.AddChidren(btnMsg);
        //    //向右图标
        //    row.AddRightArrow();
        //    row.MouseUpEvent += (sender, e) =>
        //    {
        //        var form = new PirSensorLightPerceptionRegulationForm();
        //        form.AddForm(this.deviceIASZone, Lightconfigure);
        //    };
        //}
 
        //#endregion
 
        //#region ■ 获取配置信息_______________________
 
        ///// <summary>
        ///// 设置灯光的配置信息
        ///// </summary>
        //private async void SetLightSettionData()
        //{
        //    //开启进度条
        //    this.ShowProgressBar();
 
        //    var result = await HdlPirSensorLogic.Current.GetPirSensorLightSettion(deviceIASZone);
        //    if (result == null)
        //    {
        //        //关闭进度条
        //        this.CloseProgressBar(ShowReLoadMode.YES);
        //        return;
        //    }
        //    //关闭进度条
        //    this.CloseProgressBar();
 
        //    Application.RunOnMainThread(() =>
        //    {
        //        if (this.Parent == null)
        //        {
        //            return;
        //        }
        //        this.Lightconfigure = result;
        //        //设置灯光的配置信息
        //        this.SetLightSettionData(result.transitionTime, result.levelSize);
        //    });
        //}
 
        ///// <summary>
        ///// 设置灯光的配置信息
        ///// </summary>
        ///// <param name="i_spaceTime"></param>
        ///// <param name="i_levelSize"></param>
        //private void SetLightSettionData(int i_spaceTime, int i_levelSize)
        //{
        //    if (this.btnAutoStatu != null)
        //    {
        //        //自动关灯(XX秒)
        //        this.btnAutoStatu.Text = i_spaceTime.ToString() + Language.StringByID(R.MyInternationalizationString.Second);
        //    }
        //}
 
        //#endregion
 
        //#region ■ 保存配置___________________________
 
        ///// <summary>
        ///// 保存传感器的灯光的配置信息
        ///// </summary>
        ///// <param name="i_spaceTime"></param>
        ///// <param name="i_levelSize"></param>
        ///// <returns></returns>
        //private async Task<bool> SaveLightSettionData(int i_spaceTime, int i_levelSize)
        //{
        //    //开启进度条
        //    this.ShowProgressBar();
 
        //    //先记录缓存
        //    int spaceTime = this.Lightconfigure.transitionTime;
        //    int levelSize = this.Lightconfigure.levelSize;
 
        //    //设置新值
        //    this.Lightconfigure.transitionTime = i_spaceTime;
        //    this.Lightconfigure.levelSize = i_levelSize;
 
        //    var result = await HdlPirSensorLogic.Current.SetPirSensorLightSettion(this.deviceIASZone, this.Lightconfigure);
        //    if (result == true)
        //    {
        //        Application.RunOnMainThread(() =>
        //        {
        //            //设置灯光的配置信息
        //            this.SetLightSettionData(i_spaceTime, i_levelSize);
        //        });
        //    }
        //    else
        //    {
        //        //还原缓存
        //        this.Lightconfigure.transitionTime = spaceTime;
        //        this.Lightconfigure.levelSize = levelSize;
        //    }
        //    //关闭进度条
        //    this.CloseProgressBar();
 
        //    return result;
        //}
 
        //#endregion
    }
}