From 965290476c027deb96891cde1095d9a100581a6b Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 20 二月 2020 09:13:32 +0800 Subject: [PATCH] 2020-02-20 1.优化更新。 --- Crabtree/SmartHome/HDL/Operation/Control.cs | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/Control.cs b/Crabtree/SmartHome/HDL/Operation/Control.cs index 31cf297..6001877 100644 --- a/Crabtree/SmartHome/HDL/Operation/Control.cs +++ b/Crabtree/SmartHome/HDL/Operation/Control.cs @@ -8,6 +8,7 @@ { public class Control { + public static bool IsEnterBackground = false; public bool IsCanShowTip; public System.DateTime LatestDateTime = System.DateTime.Now; @@ -218,6 +219,7 @@ case Command.READ_JOG_OPEN_TIME_ACK: case Command.SET_JOG_CLOSE_TIME_ACK: case Command.READ_JOG_CLOSE_TIME_ACK: + case Command.ReadRemarkACK: receiveFlag += ""; break; case Command.ControlMusicModel1ACK: @@ -385,7 +387,19 @@ void managerSendCount (object o) { add (); - if (Shared.SimpleControl.CommonPage.IsRemote && !isLocal) { + if (CommonPage.IsRemote && !isLocal) { + if (!SmartHome.MqttCommon.IsGatewayOnline) { + System.Console.WriteLine ($"缃戝叧涓嶅湪绾� 鍙栨秷鍙戦��:"+ SendFlag); + Packet.HaveSendCount = 3; + allDone.Set (); + return; + } + if (IsEnterBackground) { + System.Console.WriteLine ("宸茶繘鍏ュ悗鍙� 鍙栨秷鍙戦��"); + Packet.HaveSendCount = 3; + allDone.Set (); + return; + } System.Console.WriteLine ("杩滅▼鍙戦�佹暟鎹�:" + SendFlag); SmartHome.MqttCommon.MqttRemoteSend (Packet.Bytes); Packet.FlagDateTime = DateTime.Now; @@ -406,7 +420,7 @@ Packet.HaveSendCount--; //杩欓噷鏄噸鍙戜袱娆� - while (Packet.HaveSendCount < 3) { + while (Packet.HaveSendCount < 3 && BusSocket.IsRunning) { if (Packet.FlagDateTime.AddMilliseconds (1000).Ticks <= System.DateTime.Now.Ticks) { System.Console.WriteLine ("閲嶅彂鏁版嵁:" + SendFlag); BusSocket.AsyncBeginSend (Packet); @@ -550,6 +564,7 @@ case Command.READ_JOG_OPEN_TIME_CMD: case Command.SET_JOG_CLOSE_TIME_CMD: case Command.READ_JOG_CLOSE_TIME_CMD: + case Command.ReadRemark: this.SendFlag += ""; break; case Command.ControlMusicModel2: -- Gitblit v1.8.0