3 instantiations of Interaction
Aspire.Hosting (3)
InteractionService.cs (3)
62var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken); 98var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputs), cancellationToken); 118var newState = new Interaction(title, message, options, new Interaction.MessageBarInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken);
45 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)
18private Action<Interaction>? OnInteractionUpdated { get; set; } 62var newState = new Interaction(title, message, options, new Interaction.MessageBoxInteractionInfo(intent: options.Intent ?? MessageIntent.None), cancellationToken); 98var newState = new Interaction(title, message, options, new Interaction.InputsInteractionInfo(inputs), cancellationToken); 118var newState = new Interaction(title, message, options, new Interaction.MessageBarInteractionInfo(intent: options.Intent ?? MessageIntent.None, linkText: options.LinkText, linkUrl: options.LinkUrl), cancellationToken); 131internal List<Interaction> GetCurrentInteractions() 141var interactionState = (Interaction)newState!; 143interactionState.State = Interaction.InteractionState.Complete; 148private void AddInteractionUpdate(Interaction interactionUpdate) 154if (interactionUpdate.State == Interaction.InteractionState.Complete) 182internal async Task CompleteInteractionAsync(int interactionId, Func<Interaction, IServiceProvider, InteractionCompletionState> createResult, CancellationToken cancellationToken) 184Interaction? interactionState = null; 215interactionState.State = Interaction.InteractionState.Complete; 224private async Task<bool> RunValidationAsync(Interaction interactionState, InteractionCompletionState result, CancellationToken cancellationToken) 226if (result.Complete && interactionState.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo) 256internal async IAsyncEnumerable<Interaction> SubscribeInteractionUpdates([EnumeratorCancellation] CancellationToken cancellationToken = default) 258var channel = Channel.CreateUnbounded<Interaction>(); 260void WriteToChannel(Interaction resourceEvent) => 263List<Interaction> pendingInteractions; 272foreach (var interaction in pendingInteractions) 279await foreach (var item in channel.Reader.ReadAllAsync(cancellationToken).ConfigureAwait(false)) 304internal class InteractionCollection : KeyedCollection<int, Interaction> 306protected override int GetKeyForItem(Interaction item) => item.InteractionId;
Publishing\PublishingActivityReporter.cs (5)
244await foreach (var interaction in _interactionService.SubscribeInteractionUpdates(cancellationToken).ConfigureAwait(false)) 263private async Task HandleInteractionUpdateAsync(Interaction interaction, CancellationToken cancellationToken) 266if (interaction.InteractionInfo is not Interaction.InputsInteractionInfo inputsInfo || inputsInfo.Inputs.Count == 0) 271if (interaction.State == Interaction.InteractionState.InProgress) 321if (interaction.InteractionInfo is Interaction.InputsInteractionInfo inputsInfo)
Aspire.Hosting.Tests (10)
InteractionServiceTests.cs (10)
26var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 28Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 51var interaction = Assert.Single(interactionService.GetCurrentInteractions()); 53Assert.Equal(Interaction.InteractionState.InProgress, interaction.State); 122var updates = Channel.CreateUnbounded<Interaction>(); 125await foreach (var interaction in subscription.WithCancellation(CancellationToken.None)) 133var interaction1 = Assert.Single(interactionService.GetCurrentInteractions()); 138var interaction2 = interactionService.GetCurrentInteractions()[1]; 146var completedInteraction1 = await updates.Reader.ReadAsync().DefaultTimeout(); 154var completedInteraction2 = await updates.Reader.ReadAsync().DefaultTimeout();