using 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);
|
}
|
}
|
}
|
}
|