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 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 107 insertions(+), 0 deletions(-) diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs new file mode 100644 index 0000000..99f94ee --- /dev/null +++ b/SiriIntents/HDLRunSceneIntentHandlder.cs @@ -0,0 +1,107 @@ +锘縰sing System; +using Foundation; +using HDLSceneSiri; +using ObjCRuntime; +using UIKit; +//using HdlSiri; + +namespace SiriIntents +{ + public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling + { + 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 HandleHDLRunScene(HDLRunSceneIntent intent,Action<HDLRunSceneIntentResponse> completion) + { + 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