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)
303await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 314private async Task WriteInteractionUpdateToClientAsync(Interaction interaction, CancellationToken cancellationToken) 316if (interaction.State == Interaction.InteractionState.InProgress) 318if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0) 356else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo) 396if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 440else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo)
Aspire.Hosting.Tests (32)
InteractionServiceTests.cs (32)
29var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 31Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 54var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 56Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 125var updates = Channel.CreateUnbounded<Interaction>(); 128await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 136var interaction1 = Assert.Single(interactionService.GetCurrentInteractions()); 141var interaction2 = interactionService.GetCurrentInteractions()[1]; 149var completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout(); 157var completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout(); 293var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 295Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 319var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 342var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 365var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 386var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 409var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 442var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 779var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 816var updates = Channel.CreateUnbounded<Interaction>(); 819await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 846var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 847var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 856inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 869var updates = Channel.CreateUnbounded<Interaction>(); 872await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 901var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 902var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 915inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 922inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 962var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1052if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo)