fix.在线安装器,启动器

This commit is contained in:
lincube
2026-06-05 11:08:11 +08:00
parent bb4e90ea8d
commit 8c88e305ee
42 changed files with 1507 additions and 393 deletions

View File

@@ -7,14 +7,19 @@ internal sealed class WelcomeOobeStep : IOobeStep
{
private readonly CommandContext _context;
private readonly OobeStateService _oobeStateService;
private readonly DataLocationResolver _dataLocationResolver;
public WelcomeOobeStep(OobeStateService oobeStateService, CommandContext context)
public WelcomeOobeStep(
OobeStateService oobeStateService,
CommandContext context,
DataLocationResolver dataLocationResolver)
{
_oobeStateService = oobeStateService;
_context = context;
_dataLocationResolver = dataLocationResolver;
}
public async Task RunAsync(CancellationToken cancellationToken)
public async Task<OobeStepResult> RunAsync(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -27,16 +32,32 @@ internal sealed class WelcomeOobeStep : IOobeStep
if (window is null)
{
return;
return BuildCancelledResult("OOBE window could not be created.");
}
await window.WaitForEnterAsync().ConfigureAwait(false);
var completion = _oobeStateService.MarkCompleted(_context);
var draft = await window.WaitForCompletionAsync().ConfigureAwait(false);
if (draft is null)
{
Logger.Info("OOBE was cancelled before completion; Host launch will be skipped.");
return BuildCancelledResult("OOBE was cancelled before completion.");
}
var completion = new OobeSessionCommitService(
_dataLocationResolver,
_oobeStateService,
_context)
.Commit(draft);
if (!completion.Success)
{
Logger.Warn(
$"OOBE completion state was not persisted. ResultCode='{completion.ResultCode}'; " +
$"OOBE session was not persisted. ResultCode='{completion.ResultCode}'; " +
$"Error='{completion.ErrorMessage}'.");
return OobeStepResult.Complete(LaunchResultBuilder.Build(
false,
"oobe",
completion.ResultCode,
"OOBE settings could not be saved.",
errorMessage: completion.ErrorMessage));
}
await Dispatcher.UIThread.InvokeAsync(() =>
@@ -46,5 +67,16 @@ internal sealed class WelcomeOobeStep : IOobeStep
window.Close();
}
});
return OobeStepResult.Continue;
}
private static OobeStepResult BuildCancelledResult(string message)
{
return OobeStepResult.Complete(LaunchResultBuilder.Build(
false,
"oobe",
"oobe_cancelled",
message));
}
}