4 instantiations of Interaction
Aspire.Hosting (4)
InteractionService.cs (4)
121
var newState = new
Interaction
(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
195
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token);
274
var newState = new
Interaction
(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
302
var newState = new
Interaction
(options.Title ?? string.Empty, message, options, new Interaction.ProgressInteractionInfo(), interactionCts.Token);
97 references to Interaction
Aspire.Hosting (47)
Dashboard\DashboardService.cs (2)
14
using static Aspire.Hosting.
Interaction
;
85
await foreach (
var
interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (4)
154
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
213
var inputsInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
244
Interaction
.InputsInteractionInfo inputsInfo,
300
public static void ProcessInputs(IServiceProvider serviceProvider, ILogger logger,
Interaction
.InputsInteractionInfo inputsInfo, List<InputDto> inputDtos, bool dependencyChange, CancellationToken cancellationToken)
InteractionService.cs (34)
23
private Action<
Interaction
>? OnInteractionUpdated { get; set; }
121
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
195
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputCollection), interactionCts.Token);
274
var
newState = new Interaction(title, message, options, new
Interaction
.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
302
var
newState = new Interaction(options.Title ?? string.Empty, message, options, new
Interaction
.ProgressInteractionInfo(), interactionCts.Token);
341
newState.State =
Interaction
.InteractionState.Complete;
349
newState.State =
Interaction
.InteractionState.Complete;
359
newState.State =
Interaction
.InteractionState.Complete;
398
internal List<
Interaction
> GetCurrentInteractions()
408
var
interactionState = (
Interaction
)newState!;
422
private void AddInteractionUpdate(
Interaction
interactionUpdate)
428
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
456
internal void UpdateInteraction(
Interaction
interaction)
461
if (!_interactionCollection.TryGetValue(interaction.InteractionId, out
var
interactionState))
471
internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<
Interaction
, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken)
473
Interaction
? interactionState = null;
513
private void CompleteInteractionCore(
Interaction
interactionState, InteractionCompletionState completion)
517
if (interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo &&
530
interactionState.State =
Interaction
.InteractionState.Complete;
542
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
544
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
646
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
648
var channel = Channel.CreateUnbounded<
Interaction
>();
650
void WriteToChannel(
Interaction
resourceEvent) =>
653
List<
Interaction
> pendingInteractions;
662
foreach (
var
interaction in pendingInteractions)
669
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
694
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
696
protected override int GetKeyForItem(
Interaction
item) => item.InteractionId;
Pipelines\PipelineActivityReporter.cs (7)
316
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
327
private async Task WriteInteractionUpdateToClientAsync(
Interaction
interaction, CancellationToken cancellationToken)
329
if (interaction.State ==
Interaction
.InteractionState.InProgress)
331
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0)
372
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
412
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
458
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
Aspire.Hosting.Tests (50)
Dashboard\DashboardServiceTests.cs (3)
1081
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1119
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1183
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
InteractionServiceTests.cs (47)
30
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
32
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
55
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
57
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
126
var updates = Channel.CreateUnbounded<
Interaction
>();
129
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
137
var
interaction1 = Assert.Single(interactionService.GetCurrentInteractions());
142
var
interaction2 = interactionService.GetCurrentInteractions()[1];
150
var
completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout();
158
var
completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout();
376
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
378
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
402
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
425
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
448
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
469
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
492
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
525
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
862
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
899
var updates = Channel.CreateUnbounded<
Interaction
>();
902
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
929
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
930
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
939
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
952
var updates = Channel.CreateUnbounded<
Interaction
>();
955
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
984
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
985
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
998
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1005
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1045
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1173
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1209
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1259
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1260
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
1282
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1300
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1303
Assert.IsType<
Interaction
.ProgressInteractionInfo>(interaction.InteractionInfo);
1315
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
1355
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1383
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1408
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1427
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1451
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1475
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1498
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1527
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());