4 instantiations of Interaction
Aspire.Hosting (4)
InteractionService.cs (4)
121var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token); 195var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token); 274var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token); 302var newState = new Interaction(options.Title ?? string.Empty, message, options, new Interaction.ProgressInteractionInfo(), interactionCts.Token);
97 references to Interaction
Aspire.Hosting (47)
Dashboard\DashboardService.cs (2)
14using static Aspire.Hosting.Interaction; 85await foreach (var interaction in updates.WithCancellation(cts.Token).ConfigureAwait(false))
Dashboard\DashboardServiceData.cs (4)
154internal IAsyncEnumerable<Interaction> SubscribeInteractionUpdates() 213var inputsInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 244Interaction.InputsInteractionInfo inputsInfo, 300public static void ProcessInputs(IServiceProvider serviceProvider, ILogger logger, Interaction.InputsInteractionInfo inputsInfo, List<InputDto> inputDtos, bool dependencyChange, CancellationToken cancellationToken)
InteractionService.cs (34)
23private Action<Interaction>? OnInteractionUpdated { get; set; } 121var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), interactionCts.Token); 195var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputCollection), interactionCts.Token); 274var newState = new Interaction(title, message, options, new Interaction.NotificationInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), interactionCts.Token); 302var newState = new Interaction(options.Title ?? string.Empty, message, options, new Interaction.ProgressInteractionInfo(), interactionCts.Token); 341newState.State = Interaction.InteractionState.Complete; 349newState.State = Interaction.InteractionState.Complete; 359newState.State = Interaction.InteractionState.Complete; 398internal List<Interaction> GetCurrentInteractions() 408var interactionState = (Interaction)newState!; 422private void AddInteractionUpdate(Interaction interactionUpdate) 428if (interactionUpdate.State == Interaction.InteractionState.Complete) 456internal void UpdateInteraction(Interaction interaction) 461if (!_interactionCollection.TryGetValue(interaction.InteractionId, out var interactionState)) 471internal async Task ProcessInteractionFromClientAsync(int interactionId, Func<Interaction, IServiceProvider, ILogger, InteractionCompletionState> createResult, CancellationToken cancellationToken) 473Interaction? interactionState = null; 513private void CompleteInteractionCore(Interaction interactionState, InteractionCompletionState completion) 517if (interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && 530interactionState.State = Interaction.InteractionState.Complete; 542private async Task<bool> RunValidationAsync(Interaction interactionState, InteractionCompletionState result, CancellationToken cancellationToken) 544if (result.Complete && interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 646internal async IAsyncEnumerable<Interaction> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) 648var channel = Channel.CreateUnbounded<Interaction>(); 650void WriteToChannel(Interaction resourceEvent) => 653List<Interaction> pendingInteractions; 662foreach (var interaction in pendingInteractions) 669await foreach (var item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 694internal class InteractionCollection : KeyedCollection<int, Interaction> 696protected override int GetKeyForItem(Interaction item) => item.InteractionId;
Pipelines\PipelineActivityReporter.cs (7)
316await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 327private async Task WriteInteractionUpdateToClientAsync(Interaction interaction, CancellationToken cancellationToken) 329if (interaction.State == Interaction.InteractionState.InProgress) 331if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo && inputsInfo.Inputs.Count > 0) 372else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo) 412if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 458else if (interaction.InteractionInfo is Interaction.NotificationInteractionInfo)
Aspire.Hosting.Tests (50)
Dashboard\DashboardServiceTests.cs (3)
1081var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1119var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1183var interaction = Assert.Single(interactionService.GetCurrentInteractions());
InteractionServiceTests.cs (47)
30var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 32Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 55var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 57Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 126var updates = Channel.CreateUnbounded<Interaction>(); 129await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 137var interaction1 = Assert.Single(interactionService.GetCurrentInteractions()); 142var interaction2 = interactionService.GetCurrentInteractions()[1]; 150var completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout(); 158var completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout(); 376var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 378Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 402var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 425var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 448var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 469var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 492var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 525var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 862var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 899var updates = Channel.CreateUnbounded<Interaction>(); 902await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 929var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 930var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 939inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 952var updates = Channel.CreateUnbounded<Interaction>(); 955await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 984var interaction = await updates.Reader.ReadAsync().DefaultTimeout(); 985var inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 998inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 1005inputsInteractionInfo = (Interaction.InputsInteractionInfo)interaction.InteractionInfo; 1045var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1173var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1209var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1259var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1260Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 1282var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1300var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1303Assert.IsType<Interaction.ProgressInteractionInfo>(interaction.InteractionInfo); 1315if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 1355var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1383var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1408var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1427var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1451var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1475var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1498var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 1527var interaction = Assert.Single(interactionService.GetCurrentInteractions());