New file |
| | |
| | | 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
|
| | | }
|
| | | }
|