From a45fe56aeeac8f28a9891b83362954067c8166dc Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 14 八月 2020 09:07:05 +0800
Subject: [PATCH] 请合并新代码,更改多功能面板绑定表重复问题

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs |   65 +++++++++++++++++++++++---------
 1 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
index 9493372..3634885 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
@@ -123,7 +123,7 @@
             btnColorBack.X = Application.GetRealWidth(266);
             btnColorBack.Y = btnColorView.Y + btnColorView.Height / 2 - HdlControlLogic.Current.GetPictrueRealSize(20) / 2;
             frameWhiteBack.AddChidren(btnColorBack);
-            //杩涘害鏉�(+60鐨勫亸绉婚噺,鑹叉俯鐨勮寖鍥存槸 3400~6000)
+            //杩涘害鏉�(+60鐨勫亸绉婚噺,鑹叉俯鐨勮寖鍥存槸 3000~6000)
             this.seekBarColor = new SeekBarControl(611 + 120);
             seekBarColor.Y = btnLightLine.Bottom + Application.GetRealHeight(58);
             seekBarColor.X = Application.GetRealWidth(266 - 60);
@@ -132,17 +132,18 @@
             seekBarColor.SeekBarPadding = Application.GetRealWidth(60);
             seekBarColor.IsProgressTextShow = true;
             seekBarColor.ProgressBarColor = UserCenterColor.Current.Transparent;
+            seekBarColor.ProgressBarUnEnableColor = UserCenterColor.Current.Transparent;
             seekBarColor.SeekBarBackgroundColor = UserCenterColor.Current.Transparent;
             seekBarColor.ProgressTextSize = 14;
             seekBarColor.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
             seekBarColor.Gravity = Gravity.Frame;
             seekBarColor.ProgressBarUnitSring = "K";
-            seekBarColor.MinValue = 34;
+            seekBarColor.MinValue = 30;
             seekBarColor.MaxValue = 60;
             frameWhiteBack.AddChidren(seekBarColor);
             //璁剧疆鍒濆鍊�
             int colorValue = ((ColorTemperatureLight)this.device).ColorTemperature;
-            if (colorValue == 0) { colorValue = 3400; }
+            if (colorValue == 0) { colorValue = 3000; }
             seekBarColor.Progress = colorValue / 100;
 
             //铚傞福鍣ㄥ紑鍏筹細
@@ -161,6 +162,7 @@
             this.btnBuzzerSwitch = new IconBigViewControl(81, 81);
             btnBuzzerSwitch.UnSelectedImagePath = "Item/Switch.png";
             btnBuzzerSwitch.SelectedImagePath = "Item/SwitchSelected.png";
+            btnBuzzerSwitch.IsSelected = ((ColorTemperatureLight)this.device).IsBuzzerRing;
             frameWhiteBack.AddChidren(btnBuzzerSwitch);
             btnBuzzerSwitch.InitControl();
             btnBuzzerSwitch.UseClickStatu = false;
@@ -200,6 +202,12 @@
             };
             btnMiniSwitch.IsSelected = ((LightBase)this.device).OnOffStatus == 1;
             this.canSetProgressValue = btnMiniSwitch.IsSelected;
+            if (btnMiniSwitch.IsSelected == false)
+            {
+                //鍦ㄦ病鏈夋墦寮�澶滅伅寮�鍏充箣鍓�,涓嶅厑璁告粦鍔�
+                seekBarLight.Enable = false;
+                seekBarColor.Enable = false;
+            }
 
             //浜害寮�濮嬫粦鍔ㄧ殑浜嬩欢
             seekBarLight.OnStartTrackingTouchEvent += (sender, e) =>
@@ -288,7 +296,8 @@
                     if (nowColorValue != oldColorValue)
                     {
                         oldColorValue = nowColorValue;
-                        ((ColorTemperatureLight)this.device).SetColorTemperature(oldColorValue * 100);
+                        int value = 1000000 / (oldColorValue * 100);
+                        ((ColorTemperatureLight)this.device).SetColorTemperature(value);
                     }
                 }
                 if (this.canSetProgressValue == true)
@@ -302,7 +311,8 @@
                     if (nowColorValue != oldColorValue)
                     {
                         //鍙戦�佽壊娓╁��
-                        ((ColorTemperatureLight)this.device).SetColorTemperature(nowColorValue * 100);
+                        int value = 1000000 / (nowColorValue * 100);
+                        ((ColorTemperatureLight)this.device).SetColorTemperature(value);
                     }
                 }
             });
@@ -345,7 +355,13 @@
                          {
                              //褰撴槸鎵撳紑鐘舵�佹椂,缃戝叧璇村畠浼氶粯璁ゆ妸浜害鍙樻垚100%
                              //浠ラ槻涓囦竴,杩欓噷鍐嶆璇诲彇涓�涓�
-                             ((ColorTemperatureLight)device).ReadLevel();
+                             HdlThreadLogic.Current.RunThread(() =>
+                             {
+                                 ((ColorTemperatureLight)device).ReadLevel();
+                                 System.Threading.Thread.Sleep(300);
+                                 ((ColorTemperatureLight)device).ReadColorTemperature();
+                             });
+
                          }
                      }
                  });
@@ -377,24 +393,23 @@
             //濡傛灉浣忓畢鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                //((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
-                ////鍒锋柊寮�鍏崇姸鎬�
-                //this.RefreshSwitchStatu(isOpen);
+                ((ColorTemperatureLight)this.device).IsBuzzerRing = isOpen;
+                //鍒锋柊寮�鍏崇姸鎬�
+                this.RefreshSwitchStatu(isOpen);
                 return;
             }
 
             //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
-            this.StartCheckResponeResult(new List<ButtonBase> { this.btnBuzzerSwitch.btnIcon }, (result) =>
+            this.btnBuzzerSwitch.CanClick = false;
+            this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
             {
                 HdlThreadLogic.Current.RunMain(() =>
                 {
                     //鎺ユ敹鍒扮綉鍏冲洖澶�
+                    this.btnBuzzerSwitch.CanClick = true;
                     if (result == true)
                     {
                         this.btnBuzzerSwitch.IsSelected = isOpen;
-                        //bool statu = ((LightBase)this.device).OnOffStatus == 1;
-                        ////鍒锋柊寮�鍏崇姸鎬�
-                        //this.RefreshSwitchStatu(statu);
                     }
                 });
             });
@@ -461,11 +476,13 @@
         /// <param name="isOpen">鎵撳紑鐘舵��</param>
         private void RefreshSwitchStatu(bool isOpen)
         {
-            if (this.isColorProgressing == true)
+            //鍒锋柊铚傞福鍣ㄥ紑鍏崇姸鎬�
+            bool isBuzzerRing = ((ColorTemperatureLight)this.device).IsBuzzerRing;
+            if (this.btnBuzzerSwitch.IsSelected != isBuzzerRing)
             {
-                //濡傛灉鏄壊娓╂粦鍔ㄧ殑璇�,涓嶉渶瑕佸埛鏂扮晫闈�
-                return;
+                this.btnBuzzerSwitch.IsSelected = isBuzzerRing;
             }
+
             if (isOpen == true)
             {
                 //浜害鏄繀椤昏鍒锋柊鐨�  浜害 XX
@@ -480,13 +497,25 @@
                     //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫�
                     seekBarColor.Progress = (int)(((ColorTemperatureLight)this.device).ColorTemperature / 100);
                 }
-                this.btnMiniSwitch.IsSelected = true;
+                if (this.btnMiniSwitch.IsSelected == false)
+                {
+                    this.btnMiniSwitch.IsSelected = true;
+                }
+                //婊戝姩鏉″彲浠ユ粦鍔�
+                seekBarLight.Enable = true;
+                seekBarColor.Enable = true;
             }
             else
             {
                 //鍙樻洿瀛楁牱:鍏抽棴
                 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
-                this.btnMiniSwitch.IsSelected = false;
+                if (this.btnMiniSwitch.IsSelected == true)
+                {
+                    this.btnMiniSwitch.IsSelected = false;
+                }
+                //婊戝姩鏉′笉鍙互婊戝姩
+                seekBarLight.Enable = false;
+                seekBarColor.Enable = false;
             }
 
             //鍥炲鐨勭粨鏋滆,澶勪簬鎵撳紑鐘舵�佹墠鑳藉彂閫�

--
Gitblit v1.8.0