From b079d370b3c23751a5d200dc2d25f6c80977b4d4 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 11 三月 2022 15:03:50 +0800
Subject: [PATCH] 代码同步

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs
index c280a90..df3ecc3 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs
@@ -97,21 +97,25 @@
             //鍒锋柊鐣岄潰鐘舵��
             this.RefreshFormStatu(false);
             //妗�
-            var strView = Language.StringByID(StringId.Gear);
-            seekBarContr.ProgressChangedEvent += (div, value) =>
-            {
-                this.btnNowGear.Text = value + strView;
-                //婊戝姩涓�
-                if (div == 0) { this.fanData.IsProgressing = true; }
-                //婊戝姩缁撴潫
-                else
-                {
-                    this.fanData.IsProgressing = false;
-                    this.fanData.ProgressEndTime = DateTime.Now;
-                    //鍙戦�侀閫熷懡浠�
-                    this.SendSpeedComand(value);
-                }
-            };
+            var strView = Language.StringByID(StringId.Gear);
+
+            if (device.online)
+            {
+                seekBarContr.ProgressChangedEvent += (div, value) =>
+                {
+                    this.btnNowGear.Text = value + strView;
+                    //婊戝姩涓�
+                    if (div == 0) { this.fanData.IsProgressing = true; }
+                    //婊戝姩缁撴潫
+                    else
+                    {
+                        this.fanData.IsProgressing = false;
+                        this.fanData.ProgressEndTime = DateTime.Now;
+                        //鍙戦�侀閫熷懡浠�
+                        this.SendSpeedComand(value);
+                    }
+                };
+            }
         }
 
         #endregion
@@ -174,7 +178,17 @@
         /// 鍙戦�佸紑鍏冲懡浠�
         /// </summary>
         private void SendSwitchComand()
-        {
+        {
+            if (!device.online)
+            {
+                new Tip()
+                {
+                    CloseTime = 1,
+                    Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                    Direction = AMPopTipDirection.None,
+                }.Show(MainPage.BaseView);
+                return;
+            }
             this.btnSwitch.CanClick = false;
 
             string statu = this.btnSwitch.IsSelected == true ? "off" : "on";
@@ -194,7 +208,8 @@
         /// 鍙戦�侀閫熷懡浠�
         /// </summary>
         private void SendSpeedComand(int value)
-        {
+        {
+         
             var dic = new Dictionary<string, string>();
             dic.Add("fan_speed_percent", value.ToString());
             Control.Ins.SendWriteCommand(this.device, dic, true);

--
Gitblit v1.8.0