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 ()); }
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()); } }
public void ConfigureView( NSSet <INParameter> parameters, INInteraction interaction, INUIInteractiveBehavior interactiveBehavior, INUIHostedViewContext context, INUIHostedViewControllingConfigureViewHandler completion) { var success = true; var desiredSize = CGSize.Empty; switch (interaction.Intent) { case StartTimerIntent startTimerIntent: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { desiredSize = showStartTimerSuccess(startTimerIntent.EntryDescription); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { desiredSize = showConfirmation($"Start {startTimerIntent.EntryDescription}?"); } break; case StopTimerIntent _: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { var response = interaction.IntentResponse as StopTimerIntentResponse; if (!(response is null)) { desiredSize = showStopResponse(response); } } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { desiredSize = showConfirmation("Stop current entry?"); } break; default: success = false; break; } completion(success, parameters, desiredSize); }
public void ConfigureView( NSSet <INParameter> parameters, INInteraction interaction, INUIInteractiveBehavior interactiveBehavior, INUIHostedViewContext context, INUIHostedViewControllingConfigureViewHandler completion) { switch (interaction.Intent) { case StartTimerIntent startTimerIntent: var desiredSize = CGSize.Empty; if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { showStartTimerSuccess(startTimerIntent.EntryDescription); desiredSize = new CGSize(200, 60); } completion(true, parameters, desiredSize); break; case StopTimerIntent _: desiredSize = CGSize.Empty; if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { var response = interaction.IntentResponse as StopTimerIntentResponse; if (!(response is null)) { showStopResponse(response); desiredSize = new CGSize(300, 60); } } completion(true, parameters, desiredSize); break; default: completion(false, new NSSet <INParameter>(), CGSize.Empty); break; } }
public void ConfigureView( NSSet <INParameter> parameters, INInteraction interaction, INUIInteractiveBehavior interactiveBehavior, INUIHostedViewContext context, INUIHostedViewControllingConfigureViewHandler completion) { 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); }
public void ConfigureView( NSSet <INParameter> parameters, INInteraction interaction, INUIInteractiveBehavior interactiveBehavior, INUIHostedViewContext context, INUIHostedViewControllingConfigureViewHandler completion) { var success = true; var desiredSize = CGSize.Empty; switch (interaction.Intent) { case StartTimerIntent startTimerIntent: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { desiredSize = showStartTimerSuccess(startTimerIntent.EntryDescription); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { var message = string.IsNullOrEmpty(startTimerIntent.EntryDescription) ? Resources.SiriStartTimerWithEmptyDescConfirmationMessage : string.Format(Resources.SiriStartTimerConfirmationMessage, startTimerIntent.EntryDescription); desiredSize = showMessage(message); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Failure) { if (interaction.IntentResponse is StartTimerIntentResponse response) { var message = response.UserActivity.GetResponseText(); desiredSize = showMessage(message); } } break; case StartTimerFromClipboardIntent _: var description = interaction.IntentResponse.UserActivity.GetResponseText(); if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { desiredSize = showStartTimerSuccess(description); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { var message = string.IsNullOrEmpty(description) ? Resources.SiriStartTimerWithEmptyDescConfirmationMessage : string.Format(Resources.SiriStartTimerConfirmationMessage, description); desiredSize = showMessage(message); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Failure) { if (interaction.IntentResponse is StartTimerFromClipboardIntentResponse response) { var message = response.UserActivity.GetResponseText(); desiredSize = showMessage(message); } } break; case StopTimerIntent _: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { if (interaction.IntentResponse is StopTimerIntentResponse response) { desiredSize = showStopResponse(response); } } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { var entryDescription = interaction.IntentResponse.UserActivity.GetEntryDescription(); var message = string.IsNullOrEmpty(entryDescription) ? Resources.SiriStopTimerWithEmptyDescConfirmationMessage : string.Format(Resources.SiriStopTimerConfirmationMessage, entryDescription); desiredSize = showMessage(message); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Failure) { if (interaction.IntentResponse is StopTimerIntentResponse response) { var message = response.UserActivity.GetResponseText(); desiredSize = showMessage(message); } } break; case ContinueTimerIntent _: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { if (interaction.IntentResponse is ContinueTimerIntentResponse response) { desiredSize = showStartTimerSuccess(response.EntryDescription); } } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { var entryDescription = interaction.IntentResponse.UserActivity.GetEntryDescription(); var message = string.IsNullOrEmpty(entryDescription) ? Resources.SiriStartTimerWithEmptyDescConfirmationMessage : string.Format(Resources.SiriStartTimerConfirmationMessage, entryDescription); desiredSize = showMessage(message); } break; default: success = false; break; } completion(success, parameters, desiredSize); }
public void Configure(INInteraction interaction, INUIHostedViewContext context, Action <CGSize> completion) { throw new NotImplementedException(); }
public void ConfigureView( NSSet <INParameter> parameters, INInteraction interaction, INUIInteractiveBehavior interactiveBehavior, INUIHostedViewContext context, INUIHostedViewControllingConfigureViewHandler completion) { var success = true; var desiredSize = CGSize.Empty; switch (interaction.Intent) { case StartTimerIntent startTimerIntent: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { desiredSize = showStartTimerSuccess(startTimerIntent.EntryDescription); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { desiredSize = showMessage($"Start tracking {startTimerIntent.EntryDescription ?? "time"}?"); } break; case StopTimerIntent _: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { if (interaction.IntentResponse is StopTimerIntentResponse response) { desiredSize = showStopResponse(response); } } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { var entryDescription = interaction.IntentResponse.UserActivity.GetEntryDescription(); desiredSize = showMessage( $"Stop tracking {(!string.IsNullOrEmpty(entryDescription) ? entryDescription : "time")}?"); } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Failure) { if (interaction.IntentResponse is StopTimerIntentResponse response) { var message = interaction.IntentResponse.UserActivity.GetResponseText(); desiredSize = showMessage(message); } } break; case ContinueTimerIntent _: if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) { if (interaction.IntentResponse is ContinueTimerIntentResponse response) { desiredSize = showStartTimerSuccess(response.EntryDescription); } } if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) { var entryDescription = interaction.IntentResponse.UserActivity.GetEntryDescription(); desiredSize = showMessage( $"Start tracking {(!string.IsNullOrEmpty(entryDescription) ? entryDescription : "time")}?"); } break; default: success = false; break; } completion(success, parameters, desiredSize); }