wxr
2021-11-19 0edfc730dafa1407efdeb8a6eed4c88c21aa1963
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
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using CoreGraphics;
using Foundation;
using HDL_ON.Entity;
using Intents;
using IntentsUI;
using UIKit;
 
namespace Other.Siri
{
    public partial class SiriBaseView : UIViewController, IINUIAddVoiceShortcutViewControllerDelegate, IINUIEditVoiceShortcutViewControllerDelegate
    {
        VoiceShortcutDataManager VoiceShortcutDataManager;
        public SiriBaseView() : base("SiriBaseView", null)
        {
             VoiceShortcutDataManager = new VoiceShortcutDataManager();
        }
 
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
 
            //HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden = true;
            HDL_ON_iOS.AppDelegate.rootViewController.SetNavigationBarHidden(false, true);
        }
 
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            UserActivity = NSUserActivityHelper.ViewMenuActivity;
 
 
            //    var btnVS = new INUIAddVoiceShortcutButton(INUIAddVoiceShortcutButtonStyle.White);
            //    btnVS.Frame = new CGRect(20, 500, 280, 44);
            //btnVS.Shortcut = VoiceShortcutDataManager.FirstTemp().Shortcut ;
            //    View.AddSubview(btnVS);
 
            foreach(var localScene in FunctionList.List.scenes)
            {
                var cell = new  UIView();
                cell.Frame = new CGRect(20, 800, 300, 60);
            }
 
 
            var ddd = Xamarin.Essentials.DeviceInfo.VersionString;
 
 
 
 
 
            var btn = UIButton.FromType(UIButtonType.System);
            btn.Frame = new CGRect(20, 200, 280, 44);
            btn.SetTitle("Click Me", UIControlState.Normal);
            btn.TouchUpInside += (sender, e) =>
            {
 
                //HDL_ON_iOS.AppDelegate.rootViewController.SetNavigationBarHidden(HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden ? false : true, true);
                var ss = new SiriScene() { Id = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString() };
                INVoiceShortcut existingShortcut = VoiceShortcutDataManager?.VoiceShortcutForOrder(ss);
                //if (!(existingShortcut is null))
                //{
                //    var editVoiceShortcutViewController = new INUIEditVoiceShortcutViewController(existingShortcut);
                //    editVoiceShortcutViewController.Delegate = this;
                //    PresentViewController(editVoiceShortcutViewController, true, null);
                //}
                //else
                {
                    // Since the app isn't yet managing a voice shortcut for
                    // this order, present the add view controller
 
 
                    new SceneDateManager().PlaceOrder(ss);
 
                    INShortcut newShortcut = new INShortcut(ss.Intent);
                    if (!(newShortcut is null))
                    {
                        var addVoiceShortcutVC = new INUIAddVoiceShortcutViewController(newShortcut);
                        addVoiceShortcutVC.Delegate = this;
                        PresentViewController(addVoiceShortcutVC, true, null);
                    }
                }
 
            };
 
            View.AddSubview(btn);
        }
 
        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            // Release any cached data, images, etc that aren't in use.
        }
 
        public void DidFinish(INUIAddVoiceShortcutViewController controller, INVoiceShortcut voiceShortcut, NSError error)
        {
            Console.WriteLine("didF");
        }
 
        public void DidCancel(INUIAddVoiceShortcutViewController controller)
        {
            Console.WriteLine("didC");
        }
 
        public void DidUpdate(INUIEditVoiceShortcutViewController controller, INVoiceShortcut voiceShortcut, NSError error)
        {
            Console.WriteLine("didU");
        }
 
        public void DidDelete(INUIEditVoiceShortcutViewController controller, NSUuid deletedVoiceShortcutIdentifier)
        {
            Console.WriteLine("didD");
        }
 
        public void DidCancel(INUIEditVoiceShortcutViewController controller)
        {
            Console.WriteLine("didC");
        }
    }
}