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/ClothesHangerPage.cs |   94 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 84 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
index 190b378..d93b021 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
@@ -125,10 +125,17 @@
             FrameWhiteCentet1.AddChidren(btnDown);
 
             #region 鎺у埗
-            btnUp.MouseDownEventHandler = (sender, e) => {
-                btnUp.IsSelected = true;
-            };
             btnUp.MouseUpEventHandler = (sender, e) => {
+                if (!device.online)
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 new System.Threading.Thread(() =>
                 {
                     System.Threading.Thread.Sleep(2000);
@@ -143,10 +150,17 @@
                 Control.Ins.SendWriteCommand(device, d);
             };
             //----
-            btnStop.MouseDownEventHandler = (sender, e) => {
-                btnStop.IsSelected = true;
-            };
             btnStop.MouseUpEventHandler = (sender, e) => {
+                if (!device.online)
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 new System.Threading.Thread(() =>
                 {
                     System.Threading.Thread.Sleep(2000);
@@ -160,11 +174,31 @@
                 d.Add(FunctionAttributeKey.Position, "stop");
                 Control.Ins.SendWriteCommand(device, d);
             };
-            //-----
-            btnDown.MouseDownEventHandler = (sender, e) => {
-                btnDown.IsSelected = true;
-            };
+            if (!device.online)
+            {
+                btnUp.MouseDownEventHandler = (sender, e) => {
+                    btnUp.IsSelected = true;
+                };
+                btnStop.MouseDownEventHandler = (sender, e) => {
+                    btnStop.IsSelected = true;
+                };
+                //-----
+                btnDown.MouseDownEventHandler = (sender, e) =>
+                {
+                    btnDown.IsSelected = true;
+                };
+            }
             btnDown.MouseUpEventHandler = (sender, e) => {
+                if (!device.online)
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 new System.Threading.Thread(() =>
                 {
                     System.Threading.Thread.Sleep(2000);
@@ -208,6 +242,16 @@
 
                 EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                 {
+                    if (!device.online)
+                    {
+                        new Tip()
+                        {
+                            CloseTime = 1,
+                            Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                            Direction = AMPopTipDirection.None,
+                        }.Show(MainPage.BaseView);
+                    return;
+                    }
                     string onoff = hotDryView.Lighting ? "false" : "true";
                     device.SetAttrState(FunctionAttributeKey.HotDry, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -237,6 +281,16 @@
 
                 EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                 {
+                    if (!device.online)
+                    {
+                        new Tip()
+                        {
+                            CloseTime = 1,
+                            Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                            Direction = AMPopTipDirection.None,
+                        }.Show(MainPage.BaseView);
+                    return;
+                    }
                     string onoff = windDryView.Lighting ? "false" : "true";
                     device.SetAttrState(FunctionAttributeKey.WindDry, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -272,6 +326,16 @@
 
                 EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                 {
+                    if (!device.online)
+                    {
+                        new Tip()
+                        {
+                            CloseTime = 1,
+                            Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                            Direction = AMPopTipDirection.None,
+                        }.Show(MainPage.BaseView);
+                    return;
+                    }
                     string onoff = disinfectView.Lighting ? "false" : "true";
                     device.SetAttrState(FunctionAttributeKey.Disinfect, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();
@@ -312,6 +376,16 @@
 
                 EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                 {
+                    if (!device.online)
+                    {
+                        new Tip()
+                        {
+                            CloseTime = 1,
+                            Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                            Direction = AMPopTipDirection.None,
+                        }.Show(MainPage.BaseView);
+                    return;
+                    }
                     string onoff = lightingView.Lighting ? "off" : "on";
                     device.SetAttrState(FunctionAttributeKey.OnOff, onoff);
                     Dictionary<string, string> d = new Dictionary<string, string>();

--
Gitblit v1.8.0