4 instantiations of Interaction
Aspire.Hosting (4)
InteractionService.cs (4)
132
var newState = new
Interaction
(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
206
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token);
285
var newState = new
Interaction
(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl, relatedResourceNames: options.RelatedResourceNames ?? []), interactionCts.Token);
352
var newState = new
Interaction
(title, message, options, interactionInfo, interactionCts.Token);
112 references to Interaction
Aspire.Hosting (48)
Dashboard\DashboardService.cs (2)
15
using static Aspire.Hosting.
Interaction
;
104
await foreach (
var
interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (5)
155
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
214
if (interaction.InteractionInfo is not
Interaction
.TerminalInteractionInfo terminal ||
221
var inputsInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
252
Interaction
.InputsInteractionInfo inputsInfo,
308
public static void ProcessInputs(IServiceProvider serviceProvider, ILogger logger,
Interaction
.InputsInteractionInfo inputsInfo, List<InputDto> inputDtos, bool dependencyChange, CancellationToken cancellationToken)
InteractionService.cs (34)
27
private Action<
Interaction
>? OnInteractionUpdated { get; set; }
132
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
206
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputCollection), interactionCts.Token);
285
var
newState = new Interaction(title, message, options, new
Interaction
.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl, relatedResourceNames: options.RelatedResourceNames ?? []), interactionCts.Token);
306
options.Title ?? string.Empty, message, options, new
Interaction
.ProgressInteractionInfo(),
336
options.Title ?? string.Empty, message, options, new
Interaction
.TerminalInteractionInfo(terminal.Id),
342
string title, string message, InteractionOptions options,
Interaction
.InteractionInfoBase interactionInfo,
352
var
newState = new Interaction(title, message, options, interactionInfo, interactionCts.Token);
418
private void CompleteWorkInteraction(
Interaction
interaction, InteractionCompletionState completion)
448
internal List<
Interaction
> GetCurrentInteractions()
458
var
interactionState = (
Interaction
)newState!;
472
private void AddInteractionUpdate(
Interaction
interactionUpdate)
478
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
506
internal void UpdateInteraction(
Interaction
interaction)
511
if (!_interactionCollection.TryGetValue(interaction.InteractionId, out
var
interactionState))
521
internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<
Interaction
, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken)
523
Interaction
? interactionState = null;
563
private void CompleteInteractionCore(
Interaction
interactionState, InteractionCompletionState completion)
567
if (interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo &&
580
interactionState.State =
Interaction
.InteractionState.Complete;
592
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
594
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
696
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
698
var channel = Channel.CreateUnbounded<
Interaction
>();
700
void WriteToChannel(
Interaction
resourceEvent) =>
703
List<
Interaction
> pendingInteractions;
712
foreach (
var
interaction in pendingInteractions)
719
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
744
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
746
protected override int GetKeyForItem(
Interaction
item) => item.InteractionId;
Pipelines\PipelineActivityReporter.cs (7)
314
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
325
private async Task WriteInteractionUpdateToClientAsync(
Interaction
interaction, CancellationToken cancellationToken)
327
if (interaction.State ==
Interaction
.InteractionState.InProgress)
329
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0)
370
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
410
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
456
else if (interaction.InteractionInfo is
Interaction
.NotificationInteractionInfo)
Aspire.Hosting.Tests (64)
Dashboard\DashboardServiceTests.cs (4)
696
var
interaction = Assert.Single(interactions.GetCurrentInteractions());
1243
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1282
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1347
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();
480
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
482
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
506
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
529
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
552
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
573
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
596
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
629
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
966
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1003
var updates = Channel.CreateUnbounded<
Interaction
>();
1006
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
1033
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
1034
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1043
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1056
var updates = Channel.CreateUnbounded<
Interaction
>();
1059
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
1088
var
interaction = await updates.Reader.ReadAsync().DefaultTimeout();
1089
var inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1102
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1109
inputsInteractionInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
1149
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1277
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1313
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1363
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1364
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
1386
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1404
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1407
Assert.IsType<
Interaction
.ProgressInteractionInfo>(interaction.InteractionInfo);
1419
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
1460
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1488
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1513
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1532
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1556
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1580
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1603
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1632
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
ResourceCommandServiceTests.cs (2)
1372
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1373
var inputs = Assert.IsType<
Interaction
.InputsInteractionInfo>(interaction.InteractionInfo).Inputs;
Terminals\InteractionServiceTerminalTests.cs (11)
120
var
interaction = Assert.Single(service.GetCurrentInteractions());
164
var
interaction = Assert.Single(service.GetCurrentInteractions());
165
Assert.Equal(terminal.Id, Assert.IsType<
Interaction
.TerminalInteractionInfo>(interaction.InteractionInfo).TerminalId);
207
var
interaction = Assert.Single(service.GetCurrentInteractions());
243
var
interaction = Assert.Single(service.GetCurrentInteractions());
292
Assert.Equal(
Interaction
.InteractionState.InProgress, updates.Current.State);
308
var
interaction = updates.Current;
324
Assert.Equal(
Interaction
.InteractionState.Complete, updates.Current.State);
333
Assert.Equal(
Interaction
.InteractionState.InProgress, updates.Current.State);
371
var
interaction = Assert.Single(service.GetCurrentInteractions());
402
var
interaction = Assert.Single(service.GetCurrentInteractions());