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/2-Classification/FunctionControlZoneBLL.cs |  118 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 84 insertions(+), 34 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index 3b8ac47..d579862 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -79,6 +79,16 @@
 
             btnSwitch.MouseUpEventHandler = (sender, e) =>
             {
+                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 btnSwitch.IsSelected = !btnSwitch.IsSelected;
 
                 if(SPK.NotStatusSpkList.Contains( function.spk ))
@@ -109,34 +119,24 @@
         }
         #region 鐏厜鐨勪簨浠跺垪琛�
 
-        /// <summary>
-        /// 鐏厜寮�鍏充簨浠�
-        /// </summary>
-        void LoadEvent_LightSwitch(Button btnSwitch)
-        {
-            btnSwitch.MouseUpEventHandler += (sender, e) =>
-            {
-                btnSwitch.IsSelected = !btnSwitch.IsSelected;
-                new System.Threading.Thread(() =>
-                {
-                    if (SPK.LightSpkList().Contains( function.spk))
-                    {
-                        function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
-                        Dictionary<string, string> d = new Dictionary<string, string>();
-                        d.Add("on_off", function.trait_on_off.curValue.ToString());
-                        Control.Ins.SendWriteCommand(function, d);
-                    }
-                })
-                { IsBackground = true }.Start();
-            };
-        }
+
 
         /// <summary>
         /// 鐏厜浜害璋冭妭浜嬩欢
         /// </summary>
         void LoadEvent_LightDimming(DiyImageSeekBar dimmerControlBar)
         {
-            if(function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
+            if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+            {
+                //new Tip()
+                //{
+                //    CloseTime = 1,
+                //    Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                //    Direction = AMPopTipDirection.None,
+                //}.Show(MainPage.BaseView);
+                return;
+            }
+            if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
             {
                 dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => {
                     onDimmerBar = true;
@@ -192,41 +192,71 @@
         /// <param name="btnStop"></param>
         /// <param name="btnOpen"></param>
         /// <param name="btnClose"></param>
-        void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Function curtain)
+        void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose)
         {
             btnClose.MouseUpEventHandler = (sender, e) =>
             {
+                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 btnClose.IsSelected = true;
                 btnStop.IsSelected = false;
                 btnOpen.IsSelected = false;
-                curtain.trait_on_off.curValue = "off";
-                curtain.SetAttrState(FunctionAttributeKey.Percent, 0);
+                function.trait_on_off.curValue = "off";
+                function.SetAttrState(FunctionAttributeKey.Percent, 0);
                 Dictionary<string, string> d = new Dictionary<string, string>();
-                d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
-                Control.Ins.SendWriteCommand(curtain, d);
+                d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+                Control.Ins.SendWriteCommand(function, d);
             };
 
             btnStop.MouseUpEventHandler = (sender, e) =>
             {
+                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 btnStop.IsSelected = true;
                 btnClose.IsSelected = false;
                 btnOpen.IsSelected = false;
-                curtain.trait_on_off.curValue = "stop";
+                function.trait_on_off.curValue = "stop";
                 Dictionary<string, string> d = new Dictionary<string, string>();
-                d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
-                Control.Ins.SendWriteCommand(curtain, d);
+                d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+                Control.Ins.SendWriteCommand(function, d);
             };
 
             btnOpen.MouseUpEventHandler = (sender, e) =>
             {
+                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                {
+                    new Tip()
+                    {
+                        CloseTime = 1,
+                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                        Direction = AMPopTipDirection.None,
+                    }.Show(MainPage.BaseView);
+                    return;
+                }
                 btnOpen.IsSelected = true;
                 btnClose.IsSelected = false;
                 btnStop.IsSelected = false;
-                curtain.trait_on_off.curValue = "on";
-                curtain.SetAttrState(FunctionAttributeKey.Percent, 100);
+                function.trait_on_off.curValue = "on";
+                function.SetAttrState(FunctionAttributeKey.Percent, 100);
                 Dictionary<string, string> d = new Dictionary<string, string>();
-                d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
-                Control.Ins.SendWriteCommand(curtain, d);
+                d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+                Control.Ins.SendWriteCommand(function, d);
             };
         }
         #endregion
@@ -243,6 +273,16 @@
             };
             btnUp.MouseUpEventHandler = (sender, e) =>
             {
+                if (!function.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);
@@ -264,6 +304,16 @@
             };
             btnDown.MouseUpEventHandler = (sender, e) =>
             {
+                if (!function.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);

--
Gitblit v1.8.0