| | |
| | | using System; |
| | | |
| | | using CoreGraphics; |
| | | using Foundation; |
| | | using Intents; |
| | | using IntentsUI; |
| | | using UIKit; |
| | | |
| | | namespace Other.Siri |
| | | { |
| | | public partial class SiriBaseView : UIViewController |
| | | public partial class SiriBaseView : UIViewController, IINUIAddVoiceShortcutViewControllerDelegate, IINUIEditVoiceShortcutViewControllerDelegate |
| | | { |
| | | public SiriBaseView() : base("SiriBaseView", null) |
| | | { |
| | |
| | | { |
| | | base.ViewDidLoad(); |
| | | // Perform any additional setup after loading the view, typically from a nib. |
| | | |
| | | |
| | | |
| | | |
| | | var btn = UIButton.FromType(UIButtonType.System); |
| | | btn.Frame = new CGRect(20, 200, 280, 44); |
| | | btn.SetTitle("Click Me", UIControlState.Normal); |
| | | |
| | | |
| | | VoiceShortcutDataManager VoiceShortcutDataManager = new VoiceShortcutDataManager(); |
| | | 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 |
| | | 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"); |
| | | } |
| | | } |
| | | } |
| | | |