3 instantiations of Interaction
Aspire.Hosting (3)
InteractionService.cs (3)
63var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken); 99var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputs), cancellationToken); 119var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
52 references to Interaction
Aspire.Hosting (35)
Dashboard\DashboardService.cs (2)
10using static Aspire.Hosting.Interaction; 71await foreach (var interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (2)
109internal IAsyncEnumerable<Interaction> SubscribeInteractionUpdates() 166var inputsInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo;
InteractionService.cs (26)
19private Action<Interaction>? OnInteractionUpdated { get; set; } 63var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken); 99var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputs), cancellationToken); 119var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken); 132internal List<Interaction> GetCurrentInteractions() 142var interactionState = (Interaction)newState!; 144interactionState.State = Interaction.InteractionState.Complete; 149private void AddInteractionUpdate(Interaction interactionUpdate) 155if (interactionUpdate.State == Interaction.InteractionState.Complete) 183internal async Task CompleteInteractionAsync(int interactionId, Func<Interaction, IServiceProvider, InteractionCompletionState> createResult, CancellationToken cancellationToken) 185Interaction? interactionState = null; 216interactionState.State = Interaction.InteractionState.Complete; 231private async Task<bool> RunValidationAsync(Interaction interactionState, InteractionCompletionState result, CancellationToken cancellationToken) 233if (result.Complete && interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 315internal async IAsyncEnumerable<Interaction> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) 317var channel = Channel.CreateUnbounded<Interaction>(); 319void WriteToChannel(Interaction resourceEvent) => 322List<Interaction> pendingInteractions; 331foreach (var interaction in pendingInteractions) 338await foreach (var item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 363internal class InteractionCollection : KeyedCollection<int, Interaction> 365protected override int GetKeyForItem(Interaction item) => item.InteractionId;
Publishing\PublishingActivityReporter.cs (5)
245await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 264private async Task HandleInteractionUpdateAsync(Interaction interaction, CancellationToken cancellationToken) 267if (interaction.InteractionInfo is not Interaction.InputsInteractionInfo inputsInfo || inputsInfo.Inputs.Count == 0) 272if (interaction.State == Interaction.InteractionState.InProgress) 322if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo)
Aspire.Hosting.Tests (17)
InteractionServiceTests.cs (17)
25var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 27Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 50var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 52Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 121var updates = Channel.CreateUnbounded<Interaction>(); 124await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 132var interaction1 = Assert.Single(interactionService.GetCurrentInteractions()); 137var interaction2 = interactionService.GetCurrentInteractions()[1]; 145var completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout(); 153var completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout(); 192var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 194Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 214var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 233var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 253var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 273var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 303var interaction = Assert.Single(interactionService.GetCurrentInteractions());