Service: offer to start it right after installing (uninstall already stops first)
- After a successful install, both entry points now ask "start it now?" (Yes/No): the app's Service menu (RunServiceVerbAsync reused for the follow-up start) and the app installer's optional service step. Without this the service only comes up at the next boot, so a first-time user saw nothing happen after installing it. - Uninstall already stops the service before deleting (DoUninstall -> DoStop, which waits up to 15s for Stopped), so nothing to change there - confirmed, not added. - Manual: note the start-now prompt in the service section. No new automated test: these are UI Yes/No prompts layered on the already-tested start/stop verbs. Gate 46/46. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
aa5707f8e1
commit
0102aa51f4
@@ -187,11 +187,32 @@ internal static class AppInstaller
|
||||
{
|
||||
log?.Invoke("install: user opted to install the service too");
|
||||
var rc = ServiceControl.RunElevated(ServiceControl.InstallVerb);
|
||||
MessageBox.Show(owner,
|
||||
rc == 0
|
||||
? "The RemSound service was installed. Configure and start it from the app's Service menu when you want it running."
|
||||
: "The RemSound service was not installed (the elevation prompt was declined, or it failed). You can try again later from the app's Service menu.",
|
||||
"RemSound service", MessageBoxButtons.OK, rc == 0 ? MessageBoxIcon.Information : MessageBoxIcon.Warning);
|
||||
if (rc == 0)
|
||||
{
|
||||
// Offer to start it now — otherwise it only comes up at the next boot, so a
|
||||
// first-time user sees nothing happen after installing it.
|
||||
var startNow = MessageBox.Show(owner,
|
||||
"The RemSound service was installed." + Environment.NewLine + Environment.NewLine +
|
||||
"Do you want to start it now? It will also start automatically at every boot. " +
|
||||
"You can configure who it sends to from the app's Service menu.",
|
||||
"Start the RemSound service?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (startNow == DialogResult.Yes)
|
||||
{
|
||||
log?.Invoke("install: user opted to start the service now");
|
||||
var startRc = ServiceControl.RunElevated(ServiceControl.StartVerb);
|
||||
MessageBox.Show(owner,
|
||||
startRc == 0
|
||||
? "The RemSound service is running."
|
||||
: "The service was installed but couldn't be started just now. You can start it later from the app's Service menu.",
|
||||
"RemSound service", MessageBoxButtons.OK, startRc == 0 ? MessageBoxIcon.Information : MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(owner,
|
||||
"The RemSound service was not installed (the elevation prompt was declined, or it failed). You can try again later from the app's Service menu.",
|
||||
"RemSound service", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user