From b02e8275a21dc06bf54b66273485d44e007a2616 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 20 七月 2020 14:50:17 +0800
Subject: [PATCH] 新代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs |  779 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 779 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
new file mode 100644
index 0000000..f290658
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
@@ -0,0 +1,779 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using ZigBee.Device;
+namespace Shared.Phone.UserCenter.DevicePanel
+{
+    public class PanelBackLighWithSensorForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________ 
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalScrolViewLayout listview = null;
+        /// <summary>
+        /// 闈㈡澘鐨勫洖璺�
+        /// </summary>
+        private Panel panelDevice = null;
+        /// <summary>
+        /// 浜害璋冭妭鐨勪俊鎭�
+        /// </summary>
+        private Panel.PanelSwitchLevelInfo linghtLevelInfo = null;
+        /// <summary>
+        /// 浜害璋冭妭鐨勪俊鎭�
+        /// </summary>
+        private Panel.PanelProximitySensorInfo proximitySensorsInfo = null;
+        /// <summary>
+        /// 鑺傝兘妯″紡
+        /// </summary>
+        private Panel.PanelSaveEnergyModeInfo energyModeInfo = null;
+        /// <summary>
+        /// 鎸夐敭鐨勯鑹叉暟鎹�
+        /// </summary>
+        private Panel.KeyColorData keyColorData = null;
+        /// <summary>
+        /// 閫夋嫨鐫$湢鏃堕棿鐨勪簨浠� value:绱㈠紩(浠�0寮�濮�)  鏂囨湰淇℃伅璇风敤Text鑾峰彇
+        /// </summary>
+        public Action<int> timeAction = null;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮�
+        /// </summary>
+        private int nowSelectNo = 0;
+        /// <summary>
+        /// /// <summary>
+        /// 鐫$湢鏃堕棿鐨勫��
+        /// </summary>
+        /// </summary>
+        public string sleepTimeText
+        {
+            get { return btnSleepTime.Text; }
+            set { btnSleepTime.Text = value; }
+        }
+        /// <summary>
+        ///鐫$湢鏃堕棿 
+        /// </summary>
+        public NormalViewControl btnSleepTime = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_listdevice">闈㈡澘璁惧鐨勫叏閮ㄥ洖璺�</param>
+        public void ShowForm(Panel i_panel)
+        {
+            this.ScrollEnabled = false;
+
+            this.panelDevice = i_panel;
+
+            //璁剧疆鏍囬淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackLight));
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鍒濆鍖栦腑閮ㄦ帶浠�
+                this.InitMiddleFrame();
+            });
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private async void InitMiddleFrame()
+        {
+            //鑾峰彇璁惧鍒濆鏁版嵁
+            var result = await this.GetDeviceDefultData();
+            if (result == false)
+            {
+                return;
+            }
+
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                listview = new VerticalScrolViewLayout();
+                listview.Height = Application.GetRealHeight(1981 - 184);
+                bodyFrameLayout.AddChidren(listview);
+
+                //娣诲姞鑺傝兘妯″紡
+                this.AddEnergyConservationRow();
+                //娣诲姞鐐瑰嚮鍓嶏紝浜害杩涘害鏉�
+                this.AddBeforeClickProgress();
+                //娣诲姞鐐瑰嚮鍚庯紝浜害杩涘害鏉�
+                this.AddAfterClickProgress();
+
+                this.FinishInitControl(listview, energyModeInfo.enable);
+
+                //淇濆瓨
+                var btnSave = new BottomClickButton();
+                btnSave.TextID = R.MyInternationalizationString.uSave;
+                bodyFrameLayout.AddChidren(btnSave);
+                btnSave.ButtonClickEvent += (sender, e) =>
+                {
+                    //淇濆瓨闈㈡澘鏁版嵁
+                    this.SavePanelData();
+                };
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 鑺傝兘妯″紡琛宊________________________ 
+        /// <summary>
+        ///  娣诲姞鑺傝兘妯″紡琛�
+        /// </summary>
+        /// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒(鎺т欢浼哥缉浣跨敤)</param>
+        private void AddEnergyConservationRow()
+        {
+            //缂╁皬:170  鎵╁ぇ:614
+            var frameBack = new FrameRowControl();
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.UseClickStatu = false;
+            frameBack.Height = Application.GetRealHeight(170);
+            listview.AddChidren(frameBack);
+
+            //鑺傝兘妯″紡
+            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEnergyConservationMode), 400);
+            //寮�鍏虫帶浠�
+            var btnSwitch = frameBack.AddMostRightSwitchIcon();
+            btnSwitch.ButtonClickEvent += (sender, e) =>
+            {
+                btnSwitch.IsSelected = !btnSwitch.IsSelected;
+                energyModeInfo.enable = btnSwitch.IsSelected;
+                //灞曞紑鎴栬�呯缉灏忕殑楂樺害
+                var value = Application.GetRealHeight(614);
+                if (btnSwitch.IsSelected == true)
+                {
+                    frameBack.Height += value;
+                }
+                else
+                {
+                    frameBack.Height -= value;
+                }
+                //瀹瑰櫒琛ュ厖
+                this.FinishInitControl(listview, energyModeInfo.enable);
+            };
+            if (energyModeInfo.enable == true)
+            {
+                btnSwitch.IsSelected = true;
+            }
+
+            //褰撳墠浜害
+            var btnProgressView1 = new NormalViewControl(200, 49, true);
+            btnProgressView1.X = ControlCommonResourse.XXLeft;
+            btnProgressView1.Y = Application.GetRealHeight(164);
+            btnProgressView1.TextSize = 12;
+            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
+            frameBack.AddChidren(btnProgressView1);
+            var btnProgress1 = new NormalViewControl(200, 49, true);
+            btnProgress1.X = Application.GetRealWidth(222);
+            btnProgress1.Y = Application.GetRealHeight(164);
+            btnProgress1.TextSize = 12;
+            btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgress1.Text = energyModeInfo.level + "%";
+            frameBack.AddChidren(btnProgress1);
+
+            //杩涘害鏉�
+            var seekBar1 = new SeekBarControl();
+            seekBar1.Y = Application.GetRealHeight(253);
+            seekBar1.ProgressBarColor = 0xff3e99f4;
+            frameBack.AddChidren(seekBar1);
+            seekBar1.ProgressChangedEvent += (div, value) =>
+            {
+                btnProgress1.Text = value + "%";
+                //鏁版嵁鍙樻洿
+                energyModeInfo.level = value;
+            };
+            seekBar1.Progress = energyModeInfo.level;
+
+            var btnTemp1 = new NormalViewControl(200, 49, true);
+            btnTemp1.X = ControlCommonResourse.XXLeft;
+            btnTemp1.Y = Application.GetRealHeight(325);
+            btnTemp1.TextSize = 12;
+            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp1.Text = "0%";
+            frameBack.AddChidren(btnTemp1);
+
+            var btnTemp2 = new NormalViewControl(200, 49, true);
+            btnTemp2.X = listview.Width - Application.GetRealWidth(200 + 49);
+            btnTemp2.Y = Application.GetRealHeight(325);
+            btnTemp2.TextAlignment = TextAlignment.CenterRight;
+            btnTemp2.TextSize = 12;
+            btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp2.Text = "100%";
+            frameBack.AddChidren(btnTemp2);
+
+            if (energyModeInfo.enable == true)
+            {
+                //灞曞紑鎴栬�呯缉灏忕殑楂樺害
+                var value = Application.GetRealHeight(614);
+                frameBack.Height += value;
+            }
+
+            //娣诲姞鎺ヨ繎鎰熷簲
+            this.AddProximitySensorsRow(frameBack);
+
+            //搴曠嚎  
+            var btnLine = new NormalViewControl(965, 5, true);
+            btnLine.Height = 1;
+            btnLine.X = Application.GetRealWidth(52);
+            btnLine.Y = Application.GetRealHeight(484 + 127);
+            btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
+            frameBack.AddChidren(btnLine);
+
+            //娣诲姞鐫$湢鏃堕棿
+            this.AddSleepTimeRow(frameBack);
+        }
+
+        #endregion
+
+        #region 鈻� 鎺ヨ繎鎰熷簲___________________________
+
+        /// <summary>
+        /// 鎺ヨ繎鎰熷簲琛�
+        /// </summary>
+        private void AddProximitySensorsRow(FrameRowControl frameRowControl)
+        {
+            //鎺ヨ繎鎰熷簲琛�
+            var frameBack = new FrameRowControl();
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.UseClickStatu = false;
+            frameBack.Y = Application.GetRealHeight(443);
+            frameBack.Height = Application.GetRealHeight(170);
+            frameRowControl.AddChidren(frameBack);
+
+            //鎺ヨ繎鎰熷簲
+            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.ProximitySensors), 400);
+            //寮�鍏虫帶浠�
+            var btnSwitch = frameBack.AddMostRightSwitchIcon();
+
+            btnSwitch.ButtonClickEvent += (sender, e) =>
+            {
+                btnSwitch.IsSelected = !btnSwitch.IsSelected;
+                proximitySensorsInfo.enable = btnSwitch.IsSelected;
+            };
+            if (proximitySensorsInfo.enable == true)
+            {
+                btnSwitch.IsSelected = true;
+            }
+        }
+        #endregion
+
+        #region 鈻� 鐫$湢鏃堕棿___________________________
+
+        /// <summary>
+        /// 鐫$湢鏃堕棿琛�
+        /// </summary>
+        private void AddSleepTimeRow(FrameRowControl frameRowControl)
+        {
+            //鐫$湢鏃堕棿琛�
+            var frameBack = new FrameRowControl();
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.UseClickStatu = false;
+            frameBack.Y = Application.GetRealHeight(784 - 170);
+            frameBack.Height = Application.GetRealHeight(170);
+            frameRowControl.AddChidren(frameBack);
+
+            //鐫$湢鏃堕棿
+            frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SleepTime), 400);
+            //鍙崇澶�
+            frameBack.AddRightArrow();
+            btnSleepTime = new NormalViewControl(700, true);
+            switch (energyModeInfo.time)
+            {
+                case 15:
+                    btnSleepTime.Text = "15s";
+                    nowSelectNo = 0;
+                    break;
+                case 60:
+                    btnSleepTime.Text = "1min";
+                    nowSelectNo = 1;
+                    break;
+                case 300:
+                    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;
+                }
+                AddSleepTimeRow(frameRowControl);
+            };
+            frameBack.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowSelectDeviceSleepTimeListForm();
+            };
+        }
+        #endregion
+
+        #region 鈻� 鏄剧ず閫夋嫨璁惧鐫$湢鏃堕棿_______________ 
+        /// <summary>
+        /// 鏄剧ず閫夋嫨璁惧鐫$湢鏃堕棿鐨勭晫闈�
+        /// </summary>
+        public void ShowSelectDeviceSleepTimeListForm()
+        {
+            //鏄剧ず鍒楄〃
+            var listText = new List<string>();
+            listText.Add("15s");
+            listText.Add("1min");
+            listText.Add("5min");
+            //鏍囬:閫夋嫨鍔熻兘绫诲瀷
+            var title = Language.StringByID(R.MyInternationalizationString.SleepTime);
+
+            var form = new BottomItemSelectForm();
+            form.CancelCallEvent = false;//鍏佽鍙栨秷
+            form.AddForm(title, listText, null, nowSelectNo);
+            form.FinishSelectEvent += (selectNo) =>
+            {
+                if (selectNo == nowSelectNo)
+                {
+                    //閫夋嫨鐨勬槸鐩稿悓鐨�
+                    return;
+                }
+                //-1:閫夋嫨鍙栨秷
+                this.sleepTimeText = selectNo == -1 ? string.Empty : listText[selectNo];
+                nowSelectNo = selectNo;
+                //璋冪敤鍥炶皟鍑芥暟
+                this.timeAction?.Invoke(nowSelectNo);
+            };
+        }
+        #endregion
+
+        #region 鈻� 鐐瑰嚮鍓峗____________________________
+
+        /// <summary>
+        ///  娣诲姞鐐瑰嚮鍓嶇殑鑳屽厜鐏繘搴︽潯
+        /// </summary>
+        /// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒</param>
+        private void AddBeforeClickProgress()
+        {
+            //鐐瑰嚮鍓�
+            var btnClick = new NormalViewControl(600, 107, true);
+            btnClick.X = ControlCommonResourse.XXLeft;
+            btnClick.TextSize = 12;
+            btnClick.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnClick.TextID = R.MyInternationalizationString.uBeforeClick;
+            listview.AddChidren(btnClick);
+            //鑳屾櫙
+            var frameBack = new FrameLayout();
+            frameBack.Y = Application.GetRealHeight(107);
+            frameBack.Height = Application.GetRealHeight(395);
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            listview.AddChidren(frameBack);
+            //褰撳墠浜害
+            var btnProgressView1 = new NormalViewControl(200, 49, true);
+            btnProgressView1.X = ControlCommonResourse.XXLeft;
+            btnProgressView1.Y = Application.GetRealHeight(52);
+            btnProgressView1.TextSize = 12;
+            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
+            frameBack.AddChidren(btnProgressView1);
+            var btnProgress1 = new NormalViewControl(200, 49, true);
+            btnProgress1.X = Application.GetRealWidth(222);
+            btnProgress1.Y = Application.GetRealHeight(52);
+            btnProgress1.TextSize = 12;
+            btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgress1.Text = linghtLevelInfo.panelBacklightLevel + "%";
+            frameBack.AddChidren(btnProgress1);
+
+            //杩涘害鏉�
+            var seekBar1 = new SeekBarControl();
+            seekBar1.Y = Application.GetRealHeight(147);
+            frameBack.AddChidren(seekBar1);
+            seekBar1.ProgressChangedEvent += (div, value) =>
+            {
+                btnProgress1.Text = value + "%";
+                //鏁版嵁鍙樻洿
+                linghtLevelInfo.panelBacklightLevel = value;
+            };
+            seekBar1.Progress = linghtLevelInfo.panelBacklightLevel;
+
+            var btnTemp1 = new NormalViewControl(200, 49, true);
+            btnTemp1.X = ControlCommonResourse.XXLeft;
+            btnTemp1.Y = Application.GetRealHeight(216);
+            btnTemp1.TextSize = 12;
+            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp1.Text = "0%";
+            frameBack.AddChidren(btnTemp1);
+
+            var btnTemp2 = new NormalViewControl(200, 49, true);
+            btnTemp2.X = listview.Width - Application.GetRealWidth(200 + 49);
+            btnTemp2.Y = Application.GetRealHeight(216);
+            btnTemp2.TextAlignment = TextAlignment.CenterRight;
+            btnTemp2.TextSize = 12;
+            btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp2.Text = "100%";
+            frameBack.AddChidren(btnTemp2);
+
+            var frameColor = new FrameLayoutStatuControl();
+            frameColor.UseClickStatu = false;
+            frameColor.Width = Application.GetRealHeight(262);
+            frameColor.Height = this.GetPictrueRealSize(79);
+            frameColor.Y = Application.GetRealHeight(26);
+            frameColor.X = listview.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
+            frameBack.AddChidren(frameColor);
+
+            //棰滆壊
+            var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(49), false);
+            btnColorView.Gravity = Gravity.CenterVertical;
+            btnColorView.TextAlignment = TextAlignment.CenterRight;
+            btnColorView.TextSize = 12;
+            btnColorView.Y = Application.GetRealHeight(5);
+            btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnColorView.TextID = R.MyInternationalizationString.uColor;
+            frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent);
+
+            int R1 = Convert.ToInt32(this.keyColorData.CloseColorR, 16);
+            int G1 = Convert.ToInt32(this.keyColorData.CloseColorG, 16);
+            int B1 = Convert.ToInt32(this.keyColorData.CloseColorB, 16);
+            uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1);
+
+            //棰滆壊澶栨
+            var frameColorLine = new FrameLayoutStatuControl();
+            frameColorLine.UseClickStatu = false;
+            frameColorLine.Height = this.GetPictrueRealSize(79);
+            frameColorLine.Width = this.GetPictrueRealSize(79);
+            frameColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
+            frameColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
+            frameColorLine.BorderWidth = 1;
+            frameColorLine.BorderColor = 0xffcccccc;
+            frameColor.AddChidren(frameColorLine, ChidrenBindMode.NotBind);
+
+            //鍒嗕袱姝ヨ绠楋紝涓嶇劧鏈夊彲鑳藉畠寰楀嚭鐨勭粨鏋滄湁璇樊瀵艰嚧涓嶅眳涓�
+            int btnColorWidth = frameColorLine.Height - this.GetPictrueRealSize(7) - this.GetPictrueRealSize(7);
+            var btnColor = new NormalViewControl(btnColorWidth, btnColorWidth, false);
+            btnColor.Gravity = Gravity.Center;
+            btnColor.Radius = (uint)btnColorWidth / 2;
+            btnColor.BackgroundColor = backColor;
+            frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind);
+            frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent);
+
+            //鍙樻洿婊戝姩鏉$殑棰滆壊
+            seekBar1.ProgressBarColor = backColor;
+
+            var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false);
+            btnRight.UnSelectedImagePath = "Item/RightNext.png";
+            btnRight.Y = Application.GetRealHeight(5);
+            btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
+            frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent);
+            btnRight.Y += this.GetPictrueRealSize(8);
+
+            frameColor.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new PanelColorSelectForm();
+                form.AddForm(R1, G1, B1);
+                form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
+                {
+                    R1 = Rcolor;
+                    G1 = Gcolor;
+                    B1 = Bcolor;
+
+                    this.keyColorData.CloseColorR = Convert.ToString(Rcolor, 16);
+                    this.keyColorData.CloseColorG = Convert.ToString(Gcolor, 16);
+                    this.keyColorData.CloseColorB = Convert.ToString(Bcolor, 16);
+
+                    btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
+                    //鍙樻洿婊戝姩鏉$殑棰滆壊
+                    seekBar1.ProgressBarColor = btnColor.BackgroundColor;
+                };
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鐐瑰嚮鍚巁____________________________
+
+        /// <summary>
+        /// 娣诲姞鐐瑰嚮鍚庣殑鑳屽厜鐏繘搴︽潯
+        /// </summary>
+        /// <param name="frameLinght">鍚勭鑳屽厜鐏殑瀹瑰櫒</param>
+        private void AddAfterClickProgress()
+        {
+            //鐐瑰嚮鍚�
+            var btnClick = new NormalViewControl(600, 107, true);
+            btnClick.X = ControlCommonResourse.XXLeft;
+            btnClick.TextSize = 12;
+            btnClick.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnClick.TextID = R.MyInternationalizationString.uAfterClick;
+            listview.AddChidren(btnClick);
+
+            //鑳屾櫙
+            var frameBack = new FrameLayout();
+            frameBack.Y = Application.GetRealHeight(608);
+            frameBack.Height = Application.GetRealHeight(395);
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            listview.AddChidren(frameBack);
+            //褰撳墠浜害
+            var btnProgressView1 = new NormalViewControl(200, 49, true);
+            btnProgressView1.X = ControlCommonResourse.XXLeft;
+            btnProgressView1.Y = Application.GetRealHeight(52);
+            btnProgressView1.TextSize = 12;
+            btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
+            frameBack.AddChidren(btnProgressView1);
+            var btnProgress1 = new NormalViewControl(200, 49, true);
+            btnProgress1.X = Application.GetRealWidth(222);
+            btnProgress1.Y = Application.GetRealHeight(52);
+            btnProgress1.TextSize = 12;
+            btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnProgress1.Text = linghtLevelInfo.panelDirectionsLevel + "%";
+            frameBack.AddChidren(btnProgress1);
+
+            //杩涘害鏉�
+            var seekBar1 = new SeekBarControl();
+            seekBar1.Y = Application.GetRealHeight(147);
+            frameBack.AddChidren(seekBar1);
+            seekBar1.ProgressChangedEvent += (div, value) =>
+            {
+                btnProgress1.Text = value + "%";
+                //鏁版嵁鍙樻洿
+                linghtLevelInfo.panelDirectionsLevel = value;
+            };
+            seekBar1.Progress = linghtLevelInfo.panelDirectionsLevel;
+
+            var btnTemp1 = new NormalViewControl(200, 49, true);
+            btnTemp1.X = ControlCommonResourse.XXLeft;
+            btnTemp1.Y = Application.GetRealHeight(216);
+            btnTemp1.TextSize = 12;
+            btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp1.Text = "0%";
+            frameBack.AddChidren(btnTemp1);
+
+            var btnTemp2 = new NormalViewControl(200, 49, true);
+            btnTemp2.X = listview.Width - Application.GetRealWidth(200 + 49);
+            btnTemp2.Y = Application.GetRealHeight(216);
+            btnTemp2.TextAlignment = TextAlignment.CenterRight;
+            btnTemp2.TextSize = 12;
+            btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTemp2.Text = "100%";
+            frameBack.AddChidren(btnTemp2);
+
+            var frameColor = new FrameLayoutStatuControl();
+            frameColor.UseClickStatu = false;
+            frameColor.Width = Application.GetRealHeight(262);
+            frameColor.Height = this.GetPictrueRealSize(79);
+            frameColor.Y = Application.GetRealHeight(26);
+            frameColor.X = listview.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
+            frameBack.AddChidren(frameColor);
+            //棰滆壊
+            var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(49), false);
+            btnColorView.Gravity = Gravity.CenterVertical;
+            btnColorView.TextAlignment = TextAlignment.CenterRight;
+            btnColorView.TextSize = 12;
+            btnColorView.Y = Application.GetRealHeight(5);
+            btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnColorView.TextID = R.MyInternationalizationString.uColor;
+            frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent);
+
+            int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16);
+            int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16);
+            int B1 = Convert.ToInt32(this.keyColorData.OpenColorB, 16);
+            uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1);
+
+            //棰滆壊澶栨
+            var frameColorLine = new FrameLayoutStatuControl();
+            frameColorLine.UseClickStatu = false;
+            frameColorLine.Height = this.GetPictrueRealSize(79);
+            frameColorLine.Width = this.GetPictrueRealSize(79);
+            frameColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
+            frameColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
+            frameColorLine.BorderWidth = 1;
+            frameColorLine.BorderColor = 0xffcccccc;
+            frameColor.AddChidren(frameColorLine, ChidrenBindMode.NotBind);
+
+            //鍒嗕袱姝ヨ绠楋紝涓嶇劧鏈夊彲鑳藉畠寰楀嚭鐨勭粨鏋滄湁璇樊瀵艰嚧涓嶅眳涓�
+            int btnColorWidth = frameColorLine.Height - this.GetPictrueRealSize(7) - this.GetPictrueRealSize(7);
+            var btnColor = new NormalViewControl(btnColorWidth, btnColorWidth, false);
+            btnColor.Gravity = Gravity.Center;
+            btnColor.Radius = (uint)btnColorWidth / 2;
+            btnColor.BackgroundColor = backColor;
+            frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind);
+            frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent);
+
+            //鍙樻洿婊戝姩鏉$殑棰滆壊
+            seekBar1.ProgressBarColor = backColor;
+
+            var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false);
+            btnRight.UnSelectedImagePath = "Item/RightNext.png";
+            btnRight.Y = Application.GetRealHeight(5);
+            btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
+            frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent);
+            btnRight.Y += this.GetPictrueRealSize(8);
+
+            frameColor.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new PanelColorSelectForm();
+                form.AddForm(R1, G1, B1);
+                form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
+                {
+                    R1 = Rcolor;
+                    G1 = Gcolor;
+                    B1 = Bcolor;
+
+                    this.keyColorData.OpenColorR = Convert.ToString(Rcolor, 16);
+                    this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16);
+                    this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16);
+
+                    btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
+                    //鍙樻洿婊戝姩鏉$殑棰滆壊
+                    seekBar1.ProgressBarColor = btnColor.BackgroundColor;
+                };
+            };
+        }
+        #endregion
+
+        #region 鈻� 鑾峰彇鍒濆鏁版嵁_______________________
+
+        /// <summary>
+        /// 鑾峰彇璁惧鍒濆鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        private async Task<bool> GetDeviceDefultData()
+        {
+            //寮�鍚繘搴︽潯
+            this.ShowProgressBar();
+            //浜害璋冭妭(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
+            linghtLevelInfo = HdlDevicePanelLogic.Current.GetDeviceLightSettion(panelDevice);
+            if (linghtLevelInfo == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return false;
+            }
+            //鎺ヨ繎鎰熷簲(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
+            proximitySensorsInfo = await HdlDevicePanelLogic.Current.GetDeviceProximitySensorsSettion(panelDevice);
+            if (proximitySensorsInfo == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return false;
+            }
+            //鑺傝兘妯″紡(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡)
+            energyModeInfo = HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(panelDevice);
+            if (energyModeInfo == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return false;
+            }
+            keyColorData = HdlDevicePanelLogic.Current.GetPanelEpointColorInfo(panelDevice);
+            if (this.keyColorData == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return false;
+            }
+            //鍏抽棴杩涘害鏉�
+            this.CloseProgressBar();
+
+            return true;
+        }
+
+        #endregion
+
+        #region 鈻� 淇濆瓨鏁版嵁___________________________
+
+        /// <summary>
+        /// 淇濆瓨闈㈡澘鏁版嵁
+        /// </summary>
+        private async void SavePanelData()
+        {
+            this.ShowProgressBar();
+            //浜害璋冭妭鏇存敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
+            var result = HdlDevicePanelLogic.Current.SetDeviceLightSettion(panelDevice, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel);
+            if (result == false)
+            {
+                this.CloseProgressBar();
+                return;
+            }
+
+            //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�)
+            //鑲栧織璞粰鎸夐敭鎺у埗闈㈡澘锛堝洓寮�鍏帶锛夎澶囷紝璇撮粯璁�15绉掓椂闂达紝杩欐牱鎺ヨ繎鎰熷簲鍔熻兘鎵嶅悎鐞�
+            result = HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
+            if (result == false)
+            {
+                this.CloseProgressBar();
+                return;
+            }
+            //鎺ヨ繎浼犳劅璁剧疆  (鑲栧織璞粰鎸夐敭鎺у埗闈㈡澘锛堝洓寮�鍏帶锛夎澶囷紝浼犳劅璺濈鍜岃Е鍙戝欢杩熸椂闂撮粯璁ょ敤鏈�澶у��)
+            result = await HdlDevicePanelLogic.Current.SetProximitySensorStatus(panelDevice, proximitySensorsInfo.enable);
+            if (result == false)
+            {
+                this.CloseProgressBar();
+                return;
+            }
+            //璁剧疆鎸夐敭闈㈡澘鎸囧畾绔偣鐨勩�愭寚绀虹伅寮�鍏抽鑹层�戠殑淇℃伅
+            result = HdlDevicePanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData);
+            this.CloseProgressBar();
+            if (result == false)
+            {
+                return;
+            }
+            //鍏抽棴鑷韩
+            this.CloseForm();
+        }
+
+        #endregion
+
+        #region 鈻� 琛ュ厖瀹瑰櫒___________________________ 
+        /// <summary>
+        /// 琛屾暟瓒呰繃瀹瑰櫒鏃讹紝琛ヤ竴涓┖鐧紽rameLayout锛屼娇涔嬭兘婊戝姩
+        /// </summary>
+        /// <param name="listview">褰撳墠婊戝姩椤佃寖鍥�</param>
+        /// <param name="enable">鏄惁娣诲姞瀹瑰櫒</param>
+        public void FinishInitControl(VerticalScrolViewLayout listview, bool enable = false)
+        {
+            //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩
+            var frameTemp = new FrameLayout();
+            listview.AddChidren(frameTemp);
+            frameTemp.Tag = "绉婚櫎瀹瑰櫒";
+            if (enable == true)
+            {
+                listview.ScrollEnabled = true;
+                frameTemp.Height = Application.GetRealHeight(2212 - 1921 + 173);
+            }
+            else
+            {
+                listview.RemoveViewByTag("绉婚櫎瀹瑰櫒");
+                listview.ScrollEnabled = false;
+            }
+        }
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 灏哛GB杞崲涓洪鑹�
+        /// </summary>
+        /// <param name="R"></param>
+        /// <param name="G"></param>
+        /// <param name="B"></param>
+        /// <returns></returns>
+        private uint GetColorByRGB(byte R, byte G, byte B)
+        {
+            return (uint)(0xFF000000 + R * 256 * 256 + G * 256 + B);
+        }
+
+        #endregion 
+    }
+}

--
Gitblit v1.8.0