4 instantiations of Interaction
Aspire.Hosting (4)
InteractionService.cs (4)
125
var newState = new
Interaction
(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
199
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token);
278
var newState = new
Interaction
(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
345
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)
154
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
213
if (interaction.InteractionInfo is not
Interaction
.TerminalInteractionInfo terminal ||
220
var inputsInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
251
Interaction
.InputsInteractionInfo inputsInfo,
307
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; }
125
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token);
199
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputCollection), interactionCts.Token);
278
var
newState = new Interaction(title, message, options, new
Interaction
.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
299
options.Title ?? string.Empty, message, options, new
Interaction
.ProgressInteractionInfo(),
329
options.Title ?? string.Empty, message, options, new
Interaction
.TerminalInteractionInfo(terminal.Id),
335
string title, string message, InteractionOptions options,
Interaction
.InteractionInfoBase interactionInfo,
345
var
newState = new Interaction(title, message, options, interactionInfo, interactionCts.Token);
411
private void CompleteWorkInteraction(
Interaction
interaction, InteractionCompletionState completion)
441
internal List<
Interaction
> GetCurrentInteractions()
451
var
interactionState = (
Interaction
)newState!;
465
private void AddInteractionUpdate(
Interaction
interactionUpdate)
471
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
499
internal void UpdateInteraction(
Interaction
interaction)
504
if (!_interactionCollection.TryGetValue(interaction.InteractionId, out
var
interactionState))
514
internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<
Interaction
, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken)
516
Interaction
? interactionState = null;
556
private void CompleteInteractionCore(
Interaction
interactionState, InteractionCompletionState completion)
560
if (interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo &&
573
interactionState.State =
Interaction
.InteractionState.Complete;
585
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
587
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
689
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
691
var channel = Channel.CreateUnbounded<
Interaction
>();
693
void WriteToChannel(
Interaction
resourceEvent) =>
696
List<
Interaction
> pendingInteractions;
705
foreach (
var
interaction in pendingInteractions)
712
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
737
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
739
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)
657
var
interaction = Assert.Single(interactions.GetCurrentInteractions());
1200
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1238
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1302
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());
ResourceCommandServiceTests.cs (2)
1370
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
1371
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());