From cbc156bc38d8b8eae7aef60cb186ab2b52fa701f Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期二, 16 七月 2024 13:59:56 +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..16ba99e 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