diff --git a/src/Uno.UI.RemoteControl.VS/EntryPoint.cs b/src/Uno.UI.RemoteControl.VS/EntryPoint.cs index 3467cf518859..8a9b81a8df58 100644 --- a/src/Uno.UI.RemoteControl.VS/EntryPoint.cs +++ b/src/Uno.UI.RemoteControl.VS/EntryPoint.cs @@ -519,14 +519,11 @@ private async Task CreateInfoBarAsync(NotificationRequestIdeMessage e, IVsShell var infoBar = await _infoBarFactory.CreateAsync( new InfoBarModel( - e.Message, - e.Commands.Select(Commands => new ActionBarItem - { - Text = Commands.Text, - Name = Commands.Name, - ActionContext = Commands.Parameter, - IsButton = true, - }).ToArray(), + new ActionBarTextSpan[] { + new(e.Title, Bold: true), + new(" " + e.Message) + }, + e.Commands.Select(Commands => new ActionBarItem(Commands.Text, Commands.Name, ActionContext: Commands.Parameter, IsButton: true)).ToArray(), e.Kind == NotificationKind.Information ? KnownMonikers.StatusInformation : KnownMonikers.StatusError, isCloseButtonVisible: true)); diff --git a/src/Uno.UI.RemoteControl.VS/GlobalJsonObserver.cs b/src/Uno.UI.RemoteControl.VS/GlobalJsonObserver.cs index e7d397e90fbe..1254ac2381b8 100644 --- a/src/Uno.UI.RemoteControl.VS/GlobalJsonObserver.cs +++ b/src/Uno.UI.RemoteControl.VS/GlobalJsonObserver.cs @@ -121,8 +121,8 @@ await _asyncPackage.GetServiceAsync(typeof(SVsShell)) is IVsShell shell && await _asyncPackage.GetServiceAsync(typeof(SVsInfoBarUIFactory)) is IVsInfoBarUIFactory infoBarFactory) { var factory = new InfoBarFactory(infoBarFactory, shell); - var restartVSItem = new ActionBarItem { Text = "Restart Visual Studio" }; - var moreInformationVSItem = new ActionBarItem { Text = "More information" }; + var restartVSItem = new ActionBarItem("Restart Visual Studio"); + var moreInformationVSItem = new ActionBarItem("More information"); var infoBar = await factory.CreateAsync( new InfoBarModel( @@ -141,7 +141,7 @@ await _asyncPackage.GetServiceAsync(typeof(SVsShell)) is IVsShell shell { _asyncPackage.JoinableTaskFactory.Run(async () => { - if (e.ActionItem == restartVSItem) + if (ReferenceEquals(e.ActionItem, restartVSItem)) { await _asyncPackage.JoinableTaskFactory.SwitchToMainThreadAsync(); @@ -152,7 +152,7 @@ await _asyncPackage.GetServiceAsync(typeof(SVsShell)) is IVsShell shell var hr = shell4.Restart((uint)type); } } - else if (e.ActionItem == moreInformationVSItem) + else if (ReferenceEquals(e.ActionItem, moreInformationVSItem)) { System.Diagnostics.Process.Start("https://aka.platform.uno/upgrade-uno-packages"); } diff --git a/src/Uno.UI.RemoteControl.VS/Notifications/InfoBar.cs b/src/Uno.UI.RemoteControl.VS/Notifications/InfoBar.cs index 524de5fa9b13..fe0f14484f26 100644 --- a/src/Uno.UI.RemoteControl.VS/Notifications/InfoBar.cs +++ b/src/Uno.UI.RemoteControl.VS/Notifications/InfoBar.cs @@ -145,19 +145,17 @@ void IVsInfoBarUIEvents.OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement } } -class ActionBarItem : IVsInfoBarActionItem -{ - public string? Text { get; set; } - - public string? Name { get; set; } - - public bool Bold { get; set; } - - public bool Italic { get; set; } - - public bool Underline { get; set; } - - public object? ActionContext { get; set; } - - public bool IsButton { get; set; } -} +record class ActionBarTextSpan( + string Text, + bool Bold = false, + bool Italic = false, + bool Underline = false) : IVsInfoBarTextSpan; + +record ActionBarItem( + string? Text, + string? Name = null, + bool Bold = false, + bool Italic = false, + bool Underline = false, + object? ActionContext = null, + bool IsButton = false) : IVsInfoBarActionItem;