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);
102
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), cancellationToken);
122
var newState = new
Interaction
(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
56 references to Interaction
Aspire.Hosting (37)
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)
111
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
168
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);
102
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputCollection), cancellationToken);
122
var
newState = new Interaction(title, message, options, new
Interaction
.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
135
internal List<
Interaction
> GetCurrentInteractions()
145
var
interactionState = (
Interaction
)newState!;
147
interactionState.State =
Interaction
.InteractionState.Complete;
152
private void AddInteractionUpdate(
Interaction
interactionUpdate)
158
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
186
internal async Task CompleteInteractionAsync(int interactionId, Func<
Interaction
, IServiceProvider, InteractionCompletionState> createResult, CancellationToken cancellationToken)
188
Interaction
? interactionState = null;
219
interactionState.State =
Interaction
.InteractionState.Complete;
234
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
236
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
318
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
320
var channel = Channel.CreateUnbounded<
Interaction
>();
322
void WriteToChannel(
Interaction
resourceEvent) =>
325
List<
Interaction
> pendingInteractions;
334
foreach (
var
interaction in pendingInteractions)
341
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
366
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
368
protected override int GetKeyForItem(
Interaction
item) => item.InteractionId;
Publishing\PublishingActivityReporter.cs (7)
245
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
264
private async Task HandleInteractionUpdateAsync(
Interaction
interaction, CancellationToken cancellationToken)
266
if (interaction.State ==
Interaction
.InteractionState.InProgress)
284
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0)
311
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
350
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
367
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
Aspire.Hosting.Tests (19)
InteractionServiceTests.cs (19)
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());
636
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
696
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());