3 instantiations of Interaction
Aspire.Hosting (3)
InteractionService.cs (3)
89
var newState = new
Interaction
(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
162
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token);
230
var newState = new
Interaction
(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
72 references to Interaction
Aspire.Hosting (40)
Dashboard\DashboardService.cs (2)
11
using static Aspire.Hosting.
Interaction
;
75
await foreach (
var
interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (3)
115
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
172
var inputsInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
194
public static void ProcessInputs(IServiceProvider serviceProvider, ILogger logger,
Interaction
.InputsInteractionInfo inputsInfo, List<InputDto> inputDtos, bool dependencyChange, CancellationToken cancellationToken)
InteractionService.cs (28)
20
private Action<
Interaction
>? OnInteractionUpdated { get; set; }
89
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
162
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputCollection), interactionCts.Token);
230
var
newState = new Interaction(title, message, options, new
Interaction
.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
248
internal List<
Interaction
> GetCurrentInteractions()
258
var
interactionState = (
Interaction
)newState!;
260
interactionState.State =
Interaction
.InteractionState.Complete;
265
private void AddInteractionUpdate(
Interaction
interactionUpdate)
271
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
299
internal void UpdateInteraction(
Interaction
interaction)
304
if (!_interactionCollection.TryGetValue(interaction.InteractionId, out
var
interactionState))
314
internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<
Interaction
, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken)
316
Interaction
? interactionState = null;
347
interactionState.State =
Interaction
.InteractionState.Complete;
362
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
364
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
450
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
452
var channel = Channel.CreateUnbounded<
Interaction
>();
454
void WriteToChannel(
Interaction
resourceEvent) =>
457
List<
Interaction
> pendingInteractions;
466
foreach (
var
interaction in pendingInteractions)
473
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
498
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
500
protected override int GetKeyForItem(
Interaction
item) => item.InteractionId;
Pipelines\PipelineActivityReporter.cs (7)
303
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
314
private async Task WriteInteractionUpdateToClientAsync(
Interaction
interaction, CancellationToken cancellationToken)
316
if (interaction.State ==
Interaction
.InteractionState.InProgress)
318
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0)
356
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
396
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
440
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
Aspire.Hosting.Tests (32)
InteractionServiceTests.cs (32)
29
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
31
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
54
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
56
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
125
var updates = Channel.CreateUnbounded<
Interaction
>();
128
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
136
var
interaction1 = Assert.Single(interactionService.GetCurrentInteractions());
141
var
interaction2 = interactionService.GetCurrentInteractions()[1];
149
var
completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout();
157
var
completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout();
293
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
295
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
319
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
342
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
365
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
386
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
409
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
442
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
779
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
816
var updates = Channel.CreateUnbounded<
Interaction
>();
819
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
846
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
847
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
856
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
869
var updates = Channel.CreateUnbounded<
Interaction
>();
872
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
901
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
902
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
915
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
922
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
962
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1052
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)