黄学彪
2020-12-16 0d9f64668fd7350d6a21fd157e32009a96d98134
ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DevicePanel
{
    public class PanelBrightnessAdjustForm : EditorCommonForm
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DevicePanel
{
    public class PanelBrightnessAdjustForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
        /// <summary>
@@ -14,7 +14,7 @@
        /// <summary>
        /// 面板的回路
        /// </summary>
        private Panel panelDevice;
        private Panel panelDevice;
        /// <summary>
        /// 设备的某一回路
        /// </summary>
@@ -34,7 +34,7 @@
        /// <summary>
        /// 按键的颜色数据
        /// </summary>
        private Panel.KeyColorData keyColorData = null;
        private Panel.KeyColorData keyColorData = null;
        /// <summary>
        /// 选择睡眠时间的事件 value:索引(从0开始)  文本信息请用Text获取
        /// </summary>
@@ -56,11 +56,11 @@
        /// <summary>
        ///睡眠时间 
        /// </summary>
        public NormalViewControl btnSleepTime = null;
        public NormalViewControl btnSleepTime = null;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
@@ -68,14 +68,14 @@
        public void ShowForm(CommonDevice device)
        {
            //左滑使能不可
            this.ScrollEnabled = false;
            this.deviceObj = device;
            this.panelDevice = new Panel();
            this.panelDevice.DeviceAddr = this.deviceObj.DeviceAddr;
            this.panelDevice.DeviceEpoint = 200;
            this.panelDevice.CurrentGateWayId = this.deviceObj.CurrentGateWayId;
            //设置头部信息
            this.ScrollEnabled = false;
            this.deviceObj = device;
            this.panelDevice = new Panel();
            this.panelDevice.DeviceAddr = this.deviceObj.DeviceAddr;
            this.panelDevice.DeviceEpoint = 200;
            this.panelDevice.CurrentGateWayId = this.deviceObj.CurrentGateWayId;
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uLightRegulation));
            //初始化中部信息
@@ -99,24 +99,24 @@
            listview = new VerticalScrolViewLayout();
            listview.Height = Application.GetRealHeight(1981 - 184);
            bodyFrameLayout.AddChidren(listview);
            bodyFrameLayout.AddChidren(listview);
            HdlThreadLogic.Current.RunMain(() =>
            {
                //添加节能模式控件
                this.AddEnergyConservationRow();
                //添加屏幕亮度级别控件
                this.AddScreenBrightnesLevelControl();
                //获取设备类型的
                var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { deviceObj });
                if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleEnvironment)
                {
                    //添加面板的颜色
                    this.AddColorControl();
                }
                this.AddScreenBrightnesLevelControl();
                //获取设备类型的
                var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { deviceObj });
                if (deviceEnumInfo.ConcreteType != DeviceConcreteType.ButtonPanel_SimpleEnvironment)
                {
                    //添加面板的颜色
                    this.AddColorControl();
                }
                this.FinishInitControl(listview, energyModeInfo.enable);
                //保存
@@ -140,7 +140,7 @@
        private void AddScreenBrightnesLevelControl()
        {
            var btnEspace = new NormalViewControl(600, 58, true);
            btnEspace.X = ControlCommonResourse.XXLeft;
            btnEspace.X = HdlControlResourse.XXLeft;
            listview.AddChidren(btnEspace);
            var frameBack = new FrameLayout();
@@ -151,7 +151,7 @@
            //屏幕亮度级别
            var btnLevelView = new NormalViewControl(400, 60, true);
            btnLevelView.X = ControlCommonResourse.XXLeft;
            btnLevelView.X = HdlControlResourse.XXLeft;
            btnLevelView.Y = Application.GetRealHeight(54);
            btnLevelView.TextID = R.MyInternationalizationString.uScreenBrightnesLevel;
            frameBack.AddChidren(btnLevelView);
@@ -167,7 +167,7 @@
            //当前亮度
            var btnProgressView1 = new NormalViewControl(200, 50, true);
            btnProgressView1.X = ControlCommonResourse.XXLeft;
            btnProgressView1.X = HdlControlResourse.XXLeft;
            btnProgressView1.Y = Application.GetRealHeight(157);
            btnProgressView1.TextSize = 12;
            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
@@ -279,7 +279,7 @@
            }
            var btnTemp1 = new NormalViewControl(200, 50, true);
            btnTemp1.X = ControlCommonResourse.XXLeft;
            btnTemp1.X = HdlControlResourse.XXLeft;
            btnTemp1.Y = Application.GetRealHeight(322);
            btnTemp1.TextSize = 12;
            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
@@ -287,7 +287,7 @@
            frameBack.AddChidren(btnTemp1);
            var btnTemp2 = new NormalViewControl(100, 50, true);
            btnTemp2.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(100);
            btnTemp2.X = frameBack.Width - HdlControlResourse.XXLeft - Application.GetRealWidth(100);
            btnTemp2.Y = Application.GetRealHeight(322);
            btnTemp2.TextAlignment = TextAlignment.CenterRight;
            btnTemp2.TextSize = 12;
@@ -305,7 +305,7 @@
        private void AddColorControl()
        {
            var btnEspace = new NormalViewControl(600, 58, true);
            btnEspace.X = ControlCommonResourse.XXLeft;
            btnEspace.X = HdlControlResourse.XXLeft;
            listview.AddChidren(btnEspace);
            //背景
@@ -317,7 +317,7 @@
            //背光灯颜色
            var btnLevelView = new NormalViewControl(400, 60, true);
            btnLevelView.X = ControlCommonResourse.XXLeft;
            btnLevelView.X = HdlControlResourse.XXLeft;
            btnLevelView.Y = Application.GetRealHeight(54);
            btnLevelView.Gravity = Gravity.CenterVertical;
            btnLevelView.TextID = R.MyInternationalizationString.BackgroundLightColor;
@@ -328,7 +328,7 @@
            frameColor.Width = Application.GetRealHeight(262);
            frameColor.Height = this.GetPictrueRealSize(79);
            frameColor.Y = Application.GetRealHeight(26);
            frameColor.X = listview.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
            frameColor.X = listview.Width - HdlControlResourse.XXLeft - Application.GetRealHeight(262);
            frameBack.AddChidren(frameColor);
            //颜色
@@ -434,7 +434,7 @@
            //当前亮度
            var btnProgressView1 = new NormalViewControl(200, 49, true);
            btnProgressView1.X = ControlCommonResourse.XXLeft;
            btnProgressView1.X = HdlControlResourse.XXLeft;
            btnProgressView1.Y = Application.GetRealHeight(164);
            btnProgressView1.TextSize = 12;
            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
@@ -468,7 +468,7 @@
            seekBar1.Progress = energyModeInfo.level;
            var btnTemp1 = new NormalViewControl(200, 49, true);
            btnTemp1.X = ControlCommonResourse.XXLeft;
            btnTemp1.X = HdlControlResourse.XXLeft;
            btnTemp1.Y = Application.GetRealHeight(325);
            btnTemp1.TextSize = 12;
            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
@@ -519,9 +519,9 @@
            frameBack.UseClickStatu = false;
            frameBack.Y = Application.GetRealHeight(443);
            frameBack.Height = Application.GetRealHeight(170);
            frameRowControl.AddChidren(frameBack);
            //接近感应
            frameRowControl.AddChidren(frameBack);
            //接近感应
            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.ProximitySensors), 400);
            //开关控件
            var btnSwitch = frameBack.AddMostRightSwitchIcon();
@@ -550,13 +550,13 @@
            frameBack.BackgroundColor = UserCenterColor.Current.White;
            frameBack.UseClickStatu = false;
            frameBack.Y = Application.GetRealHeight(784 - 170);
            frameBack.Height = Application.GetRealHeight(170);
            frameBack.Height = Application.GetRealHeight(170);
            frameRowControl.AddChidren(frameBack);
            //睡眠时间
            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SleepTime), 400);
            //右箭头
            frameBack.AddRightArrow();
            frameBack.AddRightArrow();
            btnSleepTime = new NormalViewControl(700, true);
            switch (energyModeInfo.time)
            {
@@ -572,28 +572,28 @@
                    btnSleepTime.Text = "5min";
                    nowSelectNo = 2;
                    break;
            }
            }
            frameBack.AddMostRightView(this.sleepTimeText, 700);
            timeAction = null;
            timeAction += (nowSelectNo) =>
            {
                switch (nowSelectNo)
                {
                    case 0:
                        energyModeInfo.time = 15;
                        break;
                    case 1:
                        energyModeInfo.time = 60;
                        break;
                    case 2:
                        energyModeInfo.time = 300;
                        break;
                }
            timeAction += (nowSelectNo) =>
            {
                switch (nowSelectNo)
                {
                    case 0:
                        energyModeInfo.time = 15;
                        break;
                    case 1:
                        energyModeInfo.time = 60;
                        break;
                    case 2:
                        energyModeInfo.time = 300;
                        break;
                }
                AddSleepTimeRow(frameRowControl);
            };
            frameBack.ButtonClickEvent += (sender, e) =>
            {
            {
                this.ShowSelectDeviceSleepTimeListForm();
            };
        }
@@ -624,8 +624,8 @@
                }
                //-1:选择取消
                this.sleepTimeText = selectNo == -1 ? string.Empty : listText[selectNo];
                nowSelectNo = selectNo;
                //调用回调函数
                nowSelectNo = selectNo;
                //调用回调函数
                this.timeAction?.Invoke(nowSelectNo);
            };
        }
@@ -688,10 +688,10 @@
        /// </summary>
        private async void SavePanelData()
        {
            this.ShowProgressBar();
            //节能模式修改(他们说随便一个回路就行)
            this.ShowProgressBar();
            //节能模式修改(他们说随便一个回路就行)
            var result = HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
            if (result == false)
            {
@@ -763,8 +763,8 @@
        private uint GetColorByRGB(byte R, byte G, byte B)
        {
            return (uint)(0xFF000000 + R * 256 * 256 + G * 256 + B);
        }
        }
        #endregion
    }
}
    }
}