3 instantiations of Interaction
Aspire.Hosting (3)
InteractionService.cs (3)
63
var newState = new
Interaction
(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken);
99
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputs), cancellationToken);
119
var newState = new
Interaction
(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
52 references to Interaction
Aspire.Hosting (35)
Dashboard\DashboardService.cs (2)
10
using static Aspire.Hosting.
Interaction
;
71
await foreach (
var
interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (2)
109
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
166
var inputsInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
InteractionService.cs (26)
19
private Action<
Interaction
>? OnInteractionUpdated { get; set; }
63
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken);
99
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputs), cancellationToken);
119
var
newState = new Interaction(title, message, options, new
Interaction
.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
132
internal List<
Interaction
> GetCurrentInteractions()
142
var
interactionState = (
Interaction
)newState!;
144
interactionState.State =
Interaction
.InteractionState.Complete;
149
private void AddInteractionUpdate(
Interaction
interactionUpdate)
155
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
183
internal async Task CompleteInteractionAsync(int interactionId, Func<
Interaction
, IServiceProvider, InteractionCompletionState> createResult, CancellationToken cancellationToken)
185
Interaction
? interactionState = null;
216
interactionState.State =
Interaction
.InteractionState.Complete;
231
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
233
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
315
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
317
var channel = Channel.CreateUnbounded<
Interaction
>();
319
void WriteToChannel(
Interaction
resourceEvent) =>
322
List<
Interaction
> pendingInteractions;
331
foreach (
var
interaction in pendingInteractions)
338
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
363
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
365
protected override int GetKeyForItem(
Interaction
item) => item.InteractionId;
Publishing\PublishingActivityReporter.cs (5)
245
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
264
private async Task HandleInteractionUpdateAsync(
Interaction
interaction, CancellationToken cancellationToken)
267
if (interaction.InteractionInfo is not
Interaction
.InputsInteractionInfo inputsInfo || inputsInfo.Inputs.Count == 0)
272
if (interaction.State ==
Interaction
.InteractionState.InProgress)
322
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
Aspire.Hosting.Tests (17)
InteractionServiceTests.cs (17)
25
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
27
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
50
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
52
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
121
var updates = Channel.CreateUnbounded<
Interaction
>();
124
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
132
var
interaction1 = Assert.Single(interactionService.GetCurrentInteractions());
137
var
interaction2 = interactionService.GetCurrentInteractions()[1];
145
var
completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout();
153
var
completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout();
192
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
194
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
214
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
233
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
253
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
273
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
303
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());