From d8545fbd1b36a6766c57c987e5d89862b470fed9 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 03 九月 2020 09:46:29 +0800
Subject: [PATCH] 2020-09-03 1.修改风扇默认为关状态。2.Alexa添加设备时,去掉空调和通用开关选择添加支持。 3.场景增加通用开关添加和发送控制支持,Alexa 的场景同样增加通用开关的支持。

---
 Crabtree/ON.Ios/AppDelegate.cs |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Crabtree/ON.Ios/AppDelegate.cs b/Crabtree/ON.Ios/AppDelegate.cs
index 6942a4c..b7c99bd 100644
--- a/Crabtree/ON.Ios/AppDelegate.cs
+++ b/Crabtree/ON.Ios/AppDelegate.cs
@@ -6,6 +6,7 @@
 using Microsoft.AppCenter.Analytics;
 using Microsoft.AppCenter.Crashes;
 using Shared;
+using Shared.SimpleControl;
 using UIKit;
 using UserNotifications;
 
@@ -192,14 +193,14 @@
         {
             Utlis.WriteLine ("OnResignActivation");
             //Shared.BusSocket.Stop ();
-            BusSocketStop ();
+            //BusSocketStop ();
         }
 
         public override void DidEnterBackground (UIApplication application)
         {
             SharedMethod.SharedMethod.IsBackground = true;
             Utlis.WriteLine ("DidEnterBackground");
-            //BusSocketStop ();
+            BusSocketStop ();
         }
 
         public override void WillEnterForeground (UIApplication application)
@@ -211,7 +212,7 @@
             UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
             // Called as part of the transiton from background to active state.
             // Here you can undo many of the changes made on entering the background.
-            //BusSocketStart ();
+            BusSocketStart ();
         }
 
         public override void WillTerminate (UIApplication application)
@@ -225,7 +226,7 @@
             Utlis.WriteLine ("OnActivated");
             base.OnActivated (application);
 
-            BusSocketStart ();
+            //BusSocketStart ();
             ////鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇�
             //if (!Shared.SimpleControl.MainPage.Showed) {
             //    System.Threading.Tasks.Task.Run (() => {
@@ -256,14 +257,14 @@
             //com.freeview.global.Video.FVapplicationDidBecomeActive (application);
         }
 
-        //DateTime closeTime = DateTime.MinValue;
+        DateTime closeTime = DateTime.MinValue;
         /// <summary>
         /// BusSocketStop
         /// </summary>
         void BusSocketStop ()
         {
             Shared.BusSocket.Stop ();
-            //closeTime = DateTime.Now;
+            closeTime = DateTime.Now;
         }
 
 
@@ -273,6 +274,14 @@
         void BusSocketStart ()
         {
 
+            if (closeTime == DateTime.MinValue) {
+                closeTime = DateTime.Now;
+            } else if (closeTime.AddSeconds (20) < DateTime.Now) {
+                if (CommonPage.IsRemote) {
+                    SmartHome.MqttCommon.DisConnectRemoteMqttClient ("closeTime");
+                }
+            }
+
             //if (closeTime == DateTime.MinValue) {
             //    closeTime = DateTime.Now;
             //} else if (closeTime.AddMinutes (2) > DateTime.Now) {

--
Gitblit v1.8.0