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); 102var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), cancellationToken); 122var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
56 references to Interaction
Aspire.Hosting (37)
Dashboard\DashboardService.cs (2)
10using static Aspire.Hosting.Interaction; 71await foreach (var interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (2)
111internal IAsyncEnumerable<Interaction> SubscribeInteractionUpdates() 168var 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); 102var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), cancellationToken); 122var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken); 135internal List<Interaction> GetCurrentInteractions() 145var interactionState = (Interaction)newState!; 147interactionState.State = Interaction.InteractionState.Complete; 152private void AddInteractionUpdate(Interaction interactionUpdate) 158if (interactionUpdate.State == Interaction.InteractionState.Complete) 186internal async Task CompleteInteractionAsync(int interactionId, Func<Interaction, IServiceProvider, InteractionCompletionState> createResult, CancellationToken cancellationToken) 188Interaction? interactionState = null; 219interactionState.State = Interaction.InteractionState.Complete; 234private async Task<bool> RunValidationAsync(Interaction interactionState, InteractionCompletionState result, CancellationToken cancellationToken) 236if (result.Complete && interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 318internal async IAsyncEnumerable<Interaction> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) 320var channel = Channel.CreateUnbounded<Interaction>(); 322void WriteToChannel(Interaction resourceEvent) => 325List<Interaction> pendingInteractions; 334foreach (var interaction in pendingInteractions) 341await foreach (var item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 366internal class InteractionCollection : KeyedCollection<int, Interaction> 368protected override int GetKeyForItem(Interaction item) => item.InteractionId;
Publishing\PublishingActivityReporter.cs (7)
245await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 264private async Task HandleInteractionUpdateAsync(Interaction interaction, CancellationToken cancellationToken) 266if (interaction.State == Interaction.InteractionState.InProgress) 284if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0) 311else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo) 350if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 367else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo)
Aspire.Hosting.Tests (19)
InteractionServiceTests.cs (19)
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()); 636var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 696var interaction = Assert.Single(interactionService.GetCurrentInteractions());