From 028aa977f43710839eea6c7438c345592f406ed2 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Oct 2026 10:27:07 +0000 Subject: [PATCH] fix(setup): let the elevated window's Launch start the program unelevated The unelevated parent now always knows the program path, so Launch on the success screen of an elevated all-users install works even when "Start when done" was not ticked. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.Setup/Views/SetupViewModel.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Titano.Setup/Views/SetupViewModel.cs b/src/Titano.Setup/Views/SetupViewModel.cs index 1b6d4aee..23d33222 100644 --- a/src/Titano.Setup/Views/SetupViewModel.cs +++ b/src/Titano.Setup/Views/SetupViewModel.cs @@ -343,7 +343,7 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo if (request.Scope == InstallScope.AllUsers && !Elevation.IsElevated) { - await InstallElevatedAsync(request, launch); + await InstallElevatedAsync(request, program); return; } if (!await EnsureProgramsClosedAsync(request.Directory, InstallPlan.Programs(engine.Manifest, request.Directory))) return; @@ -361,8 +361,11 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo } } - /// All users without administrator rights: an elevated copy installs with the chosen options. - private async Task InstallElevatedAsync(InstallRequest request, string? launch) + /// + /// All users without administrator rights: an elevated copy installs with the chosen options. This process + /// stays behind, hidden, to start unelevated if the copy asks for it. + /// + private async Task InstallElevatedAsync(InstallRequest request, string? program) { if (_arguments.Elevated) throw new SetupException(SetupExitCode.ElevationDeclined, "Still not elevated after relaunch."); var switches = new SetupArguments @@ -372,12 +375,12 @@ internal sealed class SetupViewModel : LocalizedViewModel, INotifyDataErrorInfo AllUsers = true, NoDesktopShortcut = !request.DesktopShortcuts, NoStartMenu = !request.StartMenuShortcuts, - Launch = launch is not null, + Launch = _launchAfter, Language = Loc.Culture.Name, }; var child = Elevation.Start(switches, WindowHandle) ?? throw new SetupException(SetupExitCode.ElevationDeclined, "Administrator approval declined."); VisibilityRequested?.Invoke(this, false); - Finish(await Elevation.WaitAsync(child, launch)); + Finish(await Elevation.WaitAsync(child, program)); } private async Task UninstallAsync()