From dd7e4794fd611de967c6322dd0bb7ffda41c2f7b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 29 十一月 2021 16:32:55 +0800 Subject: [PATCH] 增加了安防相关功能 --- SiriIntents/HDLRunSceneIntentHandlder.cs | 103 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 92 insertions(+), 11 deletions(-) diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs index 78adabf..99f94ee 100644 --- a/SiriIntents/HDLRunSceneIntentHandlder.cs +++ b/SiriIntents/HDLRunSceneIntentHandlder.cs @@ -1,26 +1,107 @@ 锘縰sing System; +using Foundation; using HDLSceneSiri; using ObjCRuntime; +using UIKit; +//using HdlSiri; namespace SiriIntents { public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling { - public HDLRunSceneIntentHandlder() + public override void ConfirmHDLRunScene (HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) { + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.InProgress, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璇风瓑寰�..."; + } + else + { + rsp.SuccessMessage = "Please wait..."; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璐﹀彿鏈櫥褰�"; + } + else + { + rsp.SuccessMessage = "Not logged in to the app"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.ContinueInApp, null); + rsp.SuccessMessage = "Ok"; + completion(rsp); + } } - public override void ConfirmRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) + public override void HandleHDLRunScene(HDLRunSceneIntent intent,Action<HDLRunSceneIntentResponse> completion) { - Console.WriteLine("asjdkfasdfa"); - - - base.ConfirmRunScene(intent, completion); - } - - public override void HandleRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) - { - throw new NotImplementedException(); + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + var result = Server.HttpServerRequest.Ins.ExecuteScene(intent.SceneId); + if (result == "0") + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Success, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц鎴愬姛"; + } + else + { + rsp.SuccessMessage = "Successful execution"; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц澶辫触"; + } + else + { + rsp.SuccessMessage = "Execution failed"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璐﹀彿鏈櫥褰�"; + } + else + { + rsp.SuccessMessage = "Not logged in to the app"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.ContinueInApp, null); + rsp.SuccessMessage = "Ok"; + completion(rsp); + } } } } -- Gitblit v1.8.0