mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 00:54:26 +08:00
fix.在线安装器,启动器
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user