黄学彪
2019-12-31 737c036a39176fd2085ce82b7c60391da8cb508c
ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorDimmingModeForm.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DevicePirSensor
{
@@ -11,6 +12,11 @@
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 传感器的配置信息
        /// </summary>
        private IASZone.ConfigureParamates pirConfigure = null;
        #endregion
        #region ■ 初始化_____________________________
@@ -18,8 +24,11 @@
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        /// <param name="i_pirConfigure">传感器的配置信息</param>
        public void ShowForm(IASZone.ConfigureParamates i_pirConfigure)
        {
            this.pirConfigure = i_pirConfigure;
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDimmingMode));
@@ -64,6 +73,7 @@
            bodyFrameLayout.AddChidren(btnSave);
            btnSave.ButtonClickEvent += (sender, e) =>
            {
                this.CloseForm();
            };
        }
@@ -82,6 +92,9 @@
            {
                listSelect.Add(i + "%");
            }
            //让它处于10的整倍数
            this.pirConfigure.dimmerLevel = (this.pirConfigure.dimmerLevel / 10) * 10;
            int index = listSelect.IndexOf(this.pirConfigure.dimmerLevel + "%");
            //开灯亮度
            var row1 = new FrameRowControl(listView.rowSpace / 2);
@@ -89,15 +102,16 @@
            var btnCaption1 = row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uTurnOnBrightness), 400);
            btnCaption1.TextSize = 15;
            row1.AddRightArrow();
            var btnStatu = row1.AddMostRightView("", 400);
            var btnStatu = row1.AddMostRightView(pirConfigure.dimmerLevel + "%", 400);
            row1.AddBottomLine();
            row1.ButtonClickEvent += (sender, e) =>
            {
                PickerView.Show(listSelect, (value) =>
                {
                    btnStatu.Text = listSelect[value];
                    pirConfigure.dimmerLevel = Convert.ToInt32(listSelect[value].Replace("%", string.Empty));
                }, 0, Language.StringByID(R.MyInternationalizationString.uBrightness),
                }, index == -1 ? 0 : index, Language.StringByID(R.MyInternationalizationString.uBrightness),
                Language.StringByID(R.MyInternationalizationString.uFinish),
                Language.StringByID(R.MyInternationalizationString.uCancel));
            };
@@ -119,6 +133,7 @@
            {
                listTime.Add(i + miao);
            }
            int index = listTime.IndexOf(this.pirConfigure.dimmerOnTime + miao);
            //慢启动
            var row2 = new FrameRowControl(listView.rowSpace / 2);
@@ -126,15 +141,16 @@
            var btnCaption2 = row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSlowStartup), 400);
            btnCaption2.TextSize = 15;
            row2.AddRightArrow();
            var btnStatu2 = row2.AddMostRightView("", 400);
            var btnStatu2 = row2.AddMostRightView(pirConfigure.dimmerOnTime + miao, 400);
            row2.AddBottomLine();
            row2.ButtonClickEvent += (sender, e) =>
            {
                PickerView.Show(listTime, (value) =>
                {
                    btnStatu2.Text = listTime[value];
                    pirConfigure.dimmerOnTime = Convert.ToInt32(listTime[value].Replace(miao, string.Empty));
                }, 0, btnCaption2.Text,
                }, index == -1 ? 0 : index, btnCaption2.Text,
                Language.StringByID(R.MyInternationalizationString.uFinish),
                Language.StringByID(R.MyInternationalizationString.uCancel));
            };
@@ -156,20 +172,23 @@
            {
                listTime.Add(i + miao);
            }
            int index = listTime.IndexOf(this.pirConfigure.dimmerOffTime + miao);
            //慢关闭
            var row3 = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(row3);
            var btnCaption3 = row3.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSlowClose), 400);
            btnCaption3.TextSize = 15;
            row3.AddRightArrow();
            var btnStatu3 = row3.AddMostRightView("", 400);
            var btnStatu3 = row3.AddMostRightView(pirConfigure.dimmerOffTime + miao, 400);
            row3.ButtonClickEvent += (sender, e) =>
            {
                PickerView.Show(listTime, (value) =>
                {
                    btnStatu3.Text = listTime[value];
                    pirConfigure.dimmerOffTime = Convert.ToInt32(listTime[value].Replace(miao, string.Empty));
                }, 0, btnCaption3.Text,
                }, index == -1 ? 0 : index, btnCaption3.Text,
                Language.StringByID(R.MyInternationalizationString.uFinish),
                Language.StringByID(R.MyInternationalizationString.uCancel));
            };