Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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: 12 additions & 1 deletion src/Bydlo.App/Services/DesktopIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ private void Refresh()
_servers.Items.Add(new NativeMenuItem
{
Header = profile.Name, ToggleType = NativeMenuItemToggleType.Radio,
Command = new RelayCommand(() => _shell.SelectedProfile = profile),
// Resolve by id on click: editing a profile replaces its item without renaming it,
// so a captured item would connect with the pre-edit settings.
Command = new RelayCommand(() => SelectProfile(profile.Id)),
});
}
_profilesState = profilesState;
Expand All @@ -210,6 +212,15 @@ private void Refresh()
_menuState = state;
}

/// <summary>Selects the current item for <paramref name="id"/>; a profile deleted meanwhile is ignored.</summary>
internal void SelectProfile(Guid id)
{
if (_shell.Profiles.FirstOrDefault(p => p.Id == id) is { } current)
{
_shell.SelectedProfile = current;
}
}

private ConnectionStatus? _iconStatus;
private void UpdateIcon()
{
Expand Down
8 changes: 8 additions & 0 deletions tools/Bydlo.Screenshots/DesktopVerification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public static void Run(MainViewModel shell, AppServices services, string output)
Pump(50);
if (!select.IsChecked || ((NativeMenuItem)servers.Items[0]).IsChecked)
{ throw new InvalidOperationException("Tray radio selection did not refresh."); }
// Editing a profile replaces its item without renaming it; the tray must select the current item,
// not the one captured when the submenu was built, or it connects with pre-edit settings.
shell.ReloadProfiles();
Pump(50);
((NativeMenuItem)servers.Items[0]).Command!.Execute(null);
Pump(50);
if (!ReferenceEquals(shell.SelectedProfile, shell.Profiles[0]))
{ throw new InvalidOperationException("Tray selected a stale profile item after a reload."); }

// Registration must remain blocked in developer sessions without touching the OS.
shell.Settings.StartWithSystem = true;
Expand Down
Loading