using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DevicePirSensor
{
///
/// PIR传感器的灯光特效配置界面★
///
public class PirSensorLightSettionForm : EditorCommonForm
{
#region ■ 变量声明___________________________
///
/// 列表控件
///
private VerticalScrolViewLayout listView = null;
///
/// 传感器设备
///
private IASZone deviceIASZone = null;
///
/// 灯光的配置
///
private IASZone.ConfigureParamates Lightconfigure = null;
///
/// 【自动关灯】行
///
//private RowSecondRightTextView btnAutoStatu = null;
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
/// 传感器设备
public void ShowForm(IASZone i_iasZone)
{
deviceIASZone = i_iasZone;
//设置头部信息
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uLightSettion));
//初始化中部信息
//this.InitMiddleFrame();
}
/////
///// 初始化中部信息
/////
//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 ■ 自动关灯___________________________
/////
///// 添加【自动关灯】行
/////
/////
//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 list = new List();
// 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;
//}
/////
///// 自动关灯的选择Action事件
/////
/////
//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 ■ 光感调节___________________________
/////
///// 添加【光感调节】行
/////
/////
//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 ■ 获取配置信息_______________________
/////
///// 设置灯光的配置信息
/////
//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);
// });
//}
/////
///// 设置灯光的配置信息
/////
/////
/////
//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 ■ 保存配置___________________________
/////
///// 保存传感器的灯光的配置信息
/////
/////
/////
/////
//private async Task 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
}
}