From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs |  225 +++++++++++++++++++++++++------------------------------
 1 files changed, 102 insertions(+), 123 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs
index ce40ff6..f1036ef 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBrightnessAdjustForm.cs
@@ -1,10 +1,10 @@
 锘縰sing 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;
@@ -327,8 +327,8 @@
             frameColor.UseClickStatu = false;
             frameColor.Width = Application.GetRealHeight(262);
             frameColor.Height = this.GetPictrueRealSize(79);
-            frameColor.Gravity = Gravity.CenterVertical;
-            frameColor.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
+            frameColor.Y = Application.GetRealHeight(26);
+            frameColor.X = listview.Width - HdlControlResourse.XXLeft - Application.GetRealHeight(262);
             frameBack.AddChidren(frameColor);
 
             //棰滆壊
@@ -346,21 +346,25 @@
             int B1 = Convert.ToInt32(this.keyColorData.OpenColorB, 16);
             uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1);
 
-            //棰滆壊澶栨 
-            var btnColorLine = new FrameLayoutStatuControl();
-            btnColorLine.Width = Application.GetRealHeight(79);
-            btnColorLine.Height = this.GetPictrueRealSize(79);
-            btnColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
-            btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
-            btnColorLine.BorderWidth = 1;
-            btnColorLine.BorderColor = 0xffcccccc;
-            frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEvent);
+            //棰滆壊澶栨
+            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);
 
-            var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false);
+            //鍒嗕袱姝ヨ绠楋紝涓嶇劧鏈夊彲鑳藉畠寰楀嚭鐨勭粨鏋滄湁璇樊瀵艰嚧涓嶅眳涓�
+            int btnColorWidth = frameColorLine.Height - this.GetPictrueRealSize(7) - this.GetPictrueRealSize(7);
+            var btnColor = new NormalViewControl(btnColorWidth, btnColorWidth, false);
             btnColor.Gravity = Gravity.Center;
-            btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2;
+            btnColor.Radius = (uint)btnColorWidth / 2;
             btnColor.BackgroundColor = backColor;
-            btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEvent);
+            frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind);
+            frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent);
 
             var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false);
             btnRight.UnSelectedImagePath = "Item/RightNext.png";
@@ -371,47 +375,22 @@
 
             frameColor.ButtonClickEvent += (sender, e) =>
             {
-                PanelColor(btnColor, R1, G1, B1);
-            };
-            btnColorView.ButtonClickEvent += (sender, e) =>
-            {
-                PanelColor(btnColor, R1, G1, B1);
-            };
-            btnColor.ButtonClickEvent += (sender, e) =>
-            {
-                PanelColor(btnColor, R1, G1, B1);
-            };
-            btnColorLine.ButtonClickEvent += (sender, e) =>
-            {
-                PanelColor(btnColor, R1, G1, B1);
-            };
-            btnRight.ButtonClickEvent += (sender, e) =>
-            {
-                PanelColor(btnColor, R1, G1, B1);
+                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);
+                };
             };
         }
-
-        /// <summary>
-        /// PanelColorSelectForm
-        /// </summary>
-        private void PanelColor(NormalViewControl btnColor, int R1, int G1, int B1)
-        {
-            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);
-            };
-        }
-
         #endregion
 
         #region 鈻� 鑺傝兘妯″紡琛宊________________________ 
@@ -455,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;
@@ -489,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;
@@ -540,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();
@@ -571,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)
             {
@@ -593,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();
             };
         }
@@ -635,7 +614,7 @@
 
             var form = new BottomItemSelectForm();
             form.CancelCallEvent = false;//鍏佽鍙栨秷
-            form.AddForm(title, listText, nowSelectNo);
+            form.AddForm(title, listText, null, nowSelectNo);
             form.FinishSelectEvent += (selectNo) =>
             {
                 if (selectNo == nowSelectNo)
@@ -645,8 +624,8 @@
                 }
                 //-1:閫夋嫨鍙栨秷
                 this.sleepTimeText = selectNo == -1 ? string.Empty : listText[selectNo];
-                nowSelectNo = selectNo;
-                //璋冪敤鍥炶皟鍑芥暟
+                nowSelectNo = selectNo;
+                //璋冪敤鍥炶皟鍑芥暟
                 this.timeAction?.Invoke(nowSelectNo);
             };
         }
@@ -709,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)
             {
@@ -784,8 +763,8 @@
         private uint GetColorByRGB(byte R, byte G, byte B)
         {
             return (uint)(0xFF000000 + R * 256 * 256 + G * 256 + B);
-        }
-
+        }
+
         #endregion
-    }
-}
+    }
+}

--
Gitblit v1.8.0