Skip to content

Commit

Permalink
Merge pull request #9608 from drewnoakes/close-info-bars-on-project-c…
Browse files Browse the repository at this point in the history
…lose

Close info bars when associated project(s) unload
  • Loading branch information
drewnoakes authored Dec 3, 2024
2 parents 3cd353a + c8da9e8 commit 079fefc
Show file tree
Hide file tree
Showing 11 changed files with 249 additions and 279 deletions.
1 change: 1 addition & 0 deletions spelling.dic
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
appsettings
args
async
asynch
awaiter
blazor
boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.ProjectSystem.VS.UI.InfoBarService;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.VS.UI.InfoBars;

namespace Microsoft.VisualStudio.Notifications;

Expand All @@ -15,7 +16,7 @@ internal class NonModalNotificationService : INonModalNotificationService
private readonly IInfoBarService _infoBarService;

[ImportingConstructor]
public NonModalNotificationService(IInfoBarService infoBarService)
public NonModalNotificationService(UnconfiguredProject _, IInfoBarService infoBarService)
{
_infoBarService = infoBarService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.ProjectSystem.Build;
using Microsoft.VisualStudio.ProjectSystem.Properties;
using Microsoft.VisualStudio.ProjectSystem.VS.UI.InfoBarService;
using Microsoft.VisualStudio.ProjectSystem.VS.UI.InfoBars;
using Microsoft.VisualStudio.Telemetry;

namespace Microsoft.VisualStudio.ProjectSystem.VS.DesignTimeBuilds;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.

using Microsoft.VisualStudio.Imaging.Interop;

namespace Microsoft.VisualStudio.ProjectSystem.VS.UI.InfoBars;

/// <summary>
/// Displays messages in the information bar attached to Visual Studio's main window.
/// </summary>
[ProjectSystemContract(ProjectSystemContractScope.UnconfiguredProject, ProjectSystemContractProvider.System)]
internal interface IInfoBarService
{
/// <summary>
/// Shows an information bar with the specified message, image and UI, replacing an existing one
/// with the same message if there is one.
/// </summary>
Task ShowInfoBarAsync(string message, ImageMoniker image, CancellationToken cancellationToken, params ImmutableArray<InfoBarAction> actions);
}

/// <summary>
/// Represents an action that can be performed via info bars, such as a button or hyperlink.
/// </summary>
/// <param name="Title">Text to show in the button or hyperlink.</param>
/// <param name="Kind">Whether to show the action as a button or hyperlink.</param>
/// <param name="Callback">The callback to invoke when the user clicks this action.</param>
/// <param name="CloseAfterAction">Whether this action should also close the info bar after invoking the callback.</param>
internal sealed record class InfoBarAction(string Title, InfoBarActionKind Kind, Action Callback, bool CloseAfterAction);

/// <summary>
/// The presentation style of an <see cref="InfoBarAction"/>.
/// </summary>
internal enum InfoBarActionKind
{
Button,
Hyperlink
}
Loading

0 comments on commit 079fefc

Please sign in to comment.