3 instantiations of Interaction
Aspire.Hosting (3)
InteractionService.cs (3)
89var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token); 162var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token); 230var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token);
72 references to Interaction
Aspire.Hosting (40)
Dashboard\DashboardService.cs (2)
11using static Aspire.Hosting.Interaction; 75await foreach (var interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (3)
115internal IAsyncEnumerable<Interaction> SubscribeInteractionUpdates() 172var inputsInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 194public static void ProcessInputs(IServiceProvider serviceProvider, ILogger logger, Interaction.InputsInteractionInfo inputsInfo, List<InputDto> inputDtos, bool dependencyChange, CancellationToken cancellationToken)
InteractionService.cs (28)
20private Action<Interaction>? OnInteractionUpdated { get; set; } 89var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token); 162var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token); 230var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token); 248internal List<Interaction> GetCurrentInteractions() 258var interactionState = (Interaction)newState!; 260interactionState.State = Interaction.InteractionState.Complete; 265private void AddInteractionUpdate(Interaction interactionUpdate) 271if (interactionUpdate.State == Interaction.InteractionState.Complete) 299internal void UpdateInteraction(Interaction interaction) 304if (!_interactionCollection.TryGetValue(interaction.InteractionId, out var interactionState)) 314internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<Interaction, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken) 316Interaction? interactionState = null; 347interactionState.State = Interaction.InteractionState.Complete; 362private async Task<bool> RunValidationAsync(Interaction interactionState, InteractionCompletionState result, CancellationToken cancellationToken) 364if (result.Complete && interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 450internal async IAsyncEnumerable<Interaction> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) 452var channel = Channel.CreateUnbounded<Interaction>(); 454void WriteToChannel(Interaction resourceEvent) => 457List<Interaction> pendingInteractions; 466foreach (var interaction in pendingInteractions) 473await foreach (var item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 498internal class InteractionCollection : KeyedCollection<int, Interaction> 500protected override int GetKeyForItem(Interaction item) => item.InteractionId;
Pipelines\PipelineActivityReporter.cs (7)
283await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 294private async Task WriteInteractionUpdateToClientAsync(Interaction interaction, CancellationToken cancellationToken) 296if (interaction.State == Interaction.InteractionState.InProgress) 298if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0) 336else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo) 376if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 420else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo)
Aspire.Hosting.Tests (32)
InteractionServiceTests.cs (32)
28var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 30Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 53var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 55Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 124var updates = Channel.CreateUnbounded<Interaction>(); 127await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 135var interaction1 = Assert.Single(interactionService.GetCurrentInteractions()); 140var interaction2 = interactionService.GetCurrentInteractions()[1]; 148var completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout(); 156var completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout(); 292var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 294Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 318var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 341var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 364var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 385var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 408var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 441var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 778var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 815var updates = Channel.CreateUnbounded<Interaction>(); 818await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 845var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 846var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 855inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 868var updates = Channel.CreateUnbounded<Interaction>(); 871await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 900var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 901var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 914inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 921inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 961var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1051if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo)