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)
283
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
294
private async Task WriteInteractionUpdateToClientAsync(
Interaction
interaction, CancellationToken cancellationToken)
296
if (interaction.State ==
Interaction
.InteractionState.InProgress)
298
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0)
336
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
376
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
420
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
Aspire.Hosting.Tests (32)
InteractionServiceTests.cs (32)
28
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
30
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
53
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
55
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
124
var updates = Channel.CreateUnbounded<
Interaction
>();
127
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
135
var
interaction1 = Assert.Single(interactionService.GetCurrentInteractions());
140
var
interaction2 = interactionService.GetCurrentInteractions()[1];
148
var
completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout();
156
var
completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout();
292
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
294
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
318
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
341
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
364
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
385
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
408
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
441
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
778
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
815
var updates = Channel.CreateUnbounded<
Interaction
>();
818
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
845
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
846
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
855
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
868
var updates = Channel.CreateUnbounded<
Interaction
>();
871
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
900
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
901
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
914
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
921
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
961
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1051
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)