3 instantiations of Interaction
Aspire.Hosting (3)
InteractionService.cs (3)
62
var newState = new
Interaction
(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken);
98
var newState = new
Interaction
(title, message, options, new Interaction.InputsInteractionInfo(inputs), cancellationToken);
118
var newState = new
Interaction
(title, message, options, new Interaction.MessageBarInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
45 references to Interaction
Aspire.Hosting (35)
Dashboard\DashboardService.cs (2)
10
using static Aspire.Hosting.
Interaction
;
71
await foreach (
var
interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (2)
109
internal IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates()
166
var inputsInfo = (
Interaction
.InputsInteractionInfo)interaction.InteractionInfo;
InteractionService.cs (26)
18
private Action<
Interaction
>? OnInteractionUpdated { get; set; }
62
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken);
98
var
newState = new Interaction(title, message, options, new
Interaction
.InputsInteractionInfo(inputs), cancellationToken);
118
var
newState = new Interaction(title, message, options, new
Interaction
.MessageBarInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
131
internal List<
Interaction
> GetCurrentInteractions()
141
var
interactionState = (
Interaction
)newState!;
143
interactionState.State =
Interaction
.InteractionState.Complete;
148
private void AddInteractionUpdate(
Interaction
interactionUpdate)
154
if (interactionUpdate.State ==
Interaction
.InteractionState.Complete)
182
internal async Task CompleteInteractionAsync(int interactionId, Func<
Interaction
, IServiceProvider, InteractionCompletionState> createResult, CancellationToken cancellationToken)
184
Interaction
? interactionState = null;
215
interactionState.State =
Interaction
.InteractionState.Complete;
224
private async Task<bool> RunValidationAsync(
Interaction
interactionState, InteractionCompletionState result, CancellationToken cancellationToken)
226
if (result.Complete && interactionState.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
256
internal async IAsyncEnumerable<
Interaction
> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default)
258
var channel = Channel.CreateUnbounded<
Interaction
>();
260
void WriteToChannel(
Interaction
resourceEvent) =>
263
List<
Interaction
> pendingInteractions;
272
foreach (
var
interaction in pendingInteractions)
279
await foreach (
var
item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
304
internal class InteractionCollection : KeyedCollection<int,
Interaction
>
306
protected override int GetKeyForItem(
Interaction
item) => item.InteractionId;
Publishing\PublishingActivityReporter.cs (5)
244
await foreach (
var
interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false))
263
private async Task HandleInteractionUpdateAsync(
Interaction
interaction, CancellationToken cancellationToken)
266
if (interaction.InteractionInfo is not
Interaction
.InputsInteractionInfo inputsInfo || inputsInfo.Inputs.Count == 0)
271
if (interaction.State ==
Interaction
.InteractionState.InProgress)
321
if (interaction.InteractionInfo is
Interaction
.InputsInteractionInfo inputsInfo)
Aspire.Hosting.Tests (10)
InteractionServiceTests.cs (10)
26
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
28
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
51
var
interaction = Assert.Single(interactionService.GetCurrentInteractions());
53
Assert.Equal(
Interaction
.InteractionState.InProgress, interaction.State);
122
var updates = Channel.CreateUnbounded<
Interaction
>();
125
await foreach (
var
interaction in subscription.WithCancellation(CancellationToken.None))
133
var
interaction1 = Assert.Single(interactionService.GetCurrentInteractions());
138
var
interaction2 = interactionService.GetCurrentInteractions()[1];
146
var
completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout();
154
var
completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout();