From 8655407ab6987bb7268fab55b6380051f26668fe Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 24 十一月 2021 10:17:15 +0800 Subject: [PATCH] 备份 --- SiriIntentsUI/IntentViewController.cs | 111 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 88 insertions(+), 23 deletions(-) diff --git a/SiriIntentsUI/IntentViewController.cs b/SiriIntentsUI/IntentViewController.cs index 44ac701..a613809 100644 --- a/SiriIntentsUI/IntentViewController.cs +++ b/SiriIntentsUI/IntentViewController.cs @@ -1,51 +1,116 @@ 锘縰sing System; using CoreGraphics; +using Foundation; +//using HDLSceneSiri; using Intents; using IntentsUI; using UIKit; namespace SiriIntentsUI { - // As an example, this extension's Info.plist has been configured to handle interactions for INSendMessageIntent. - // You will want to replace this or add other intents as appropriate. - // The intents whose interactions you wish to handle must be declared in the extension's Info.plist. - - // You can test this example integration by saying things to Siri like: - // "Send a message using <myApp>" public partial class IntentViewController : UIViewController, IINUIHostedViewControlling { protected IntentViewController(IntPtr handle) : base(handle) { - // Note: this .ctor should not contain any initialization logic. } - public override void ViewDidLoad() - { - base.ViewDidLoad(); + //public override void ViewDidLoad() + //{ + // base.ViewDidLoad(); - // Do any required interface initialization here. - } + // // Do any required interface here. + //} - public override void DidReceiveMemoryWarning() - { - // Releases the view if it doesn't have a superview. - base.DidReceiveMemoryWarning(); + //public override void DidReceiveMemoryWarning() + //{ + // // Releases the view if it doesn't have a superview. + // base.DidReceiveMemoryWarning(); - // Release any cached data, images, etc that aren't in use. - } - + // // Release any cached data, images, etc that aren't in use. + //} + [Export("configureWithInteraction:context:completion:")] public void Configure(INInteraction interaction, INUIHostedViewContext context, Action<CGSize> completion) { - // Do configuration here, including preparing views and calculating a desired size for presentation. - - if (completion != null) - completion(DesiredSize()); + throw new NotImplementedException(); } CGSize DesiredSize() { return ExtensionContext.GetHostedViewMaximumAllowedSize(); } + + + + + [Export("configureViewForParameters:ofInteraction:interactiveBehavior:context:completion:")] + public void ConfigureView( + NSSet<INParameter> parameters, + INInteraction interaction, + INUIInteractiveBehavior interactiveBehavior, + INUIHostedViewContext context, + INUIHostedViewControllingConfigureViewHandler completion) + { + + + + + //if (@available(iOS 12.0, *)) + { + //HDLRunSceneIntentResponse rsp = interaction.IntentResponse as HDLRunSceneIntentResponse; + //if (rsp.Code == HDLRunSceneIntentResponseCode.Success) + //{ + // this.messageLabel.Text = rsp.SuccessMessage; + //} + //else if (rsp.Code == HDLRunSceneIntentResponseCode.Failure || rsp.Code == HDLRunSceneIntentResponseCode.Error) + //{ + // this.messageLabel.Text = rsp.ErrorMessage; + //} + //else + { + //messageLabel.Text = "鎵ц鎴愬姛";// rsp.SuccessMessage; + } + } + CGSize size = new CGSize(DesiredSize().Width, 80); + + + //if (completion != null) + completion(true, parameters, size); + + + //var intent = interaction.Intent as OrderSoupIntent; + //if (intent is null) + //{ + // completion(false, new NSSet<INParameter>(), CGSize.Empty); + //} + + //var order = Order.FromOrderSoupIntent(intent); + + //foreach (var view in View.Subviews) + //{ + // view.RemoveFromSuperview(); + //} + + //// Different UIs can be displayed depending if the intent is in the + //// confirmation phase or the handle phase. + //var desiredSize = CGSize.Empty; + + //if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) + //{ + // desiredSize = DisplayInvoice(order, intent); + //} + //else if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) + //{ + // var response = interaction.IntentResponse as OrderSoupIntentResponse; + // if (!(response is null)) + // { + // desiredSize = DisplayOrderConfirmation(order, intent, response); + // } + //} + + //completion(true, parameters, desiredSize); + } + + } } -- Gitblit v1.8.0