wxr
2021-11-29 dd7e4794fd611de967c6322dd0bb7ffda41c2f7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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);
            }
        }
    }
}