Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VS): Adjust toast title #18653

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/Uno.UI.RemoteControl.VS/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
jeromelaban marked this conversation as resolved.
Show resolved Hide resolved
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));

Expand Down
8 changes: 4 additions & 4 deletions src/Uno.UI.RemoteControl.VS/GlobalJsonObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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();

Expand All @@ -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");
}
Expand Down
30 changes: 14 additions & 16 deletions src/Uno.UI.RemoteControl.VS/Notifications/InfoBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
jeromelaban marked this conversation as resolved.
Show resolved Hide resolved

record ActionBarItem(
string? Text
, string? Name = null
, bool Bold = false
, bool Italic = false
, bool Underline = false
, object? ActionContext = null
, bool IsButton = false) : IVsInfoBarActionItem;
Loading