2026-04-16 01:59:21 +08:00
|
|
|
|
using Avalonia.Controls;
|
|
|
|
|
|
using Avalonia.Interactivity;
|
|
|
|
|
|
using Avalonia.Markup.Xaml;
|
|
|
|
|
|
|
|
|
|
|
|
namespace LanMountainDesktop.Launcher.Views;
|
|
|
|
|
|
|
2026-04-16 19:28:58 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// OOBE(首次使用体验)窗口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class OobeWindow : Window
|
2026-04-16 01:59:21 +08:00
|
|
|
|
{
|
|
|
|
|
|
private readonly TaskCompletionSource<bool> _completionSource = new();
|
|
|
|
|
|
|
|
|
|
|
|
public OobeWindow()
|
|
|
|
|
|
{
|
|
|
|
|
|
AvaloniaXamlLoader.Load(this);
|
2026-04-16 19:28:58 +08:00
|
|
|
|
|
2026-04-16 01:59:21 +08:00
|
|
|
|
var enterButton = this.FindControl<Button>("EnterButton");
|
|
|
|
|
|
if (enterButton is not null)
|
|
|
|
|
|
{
|
|
|
|
|
|
enterButton.Click += OnEnterClick;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-16 19:28:58 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 等待用户点击开始按钮
|
|
|
|
|
|
/// </summary>
|
2026-04-16 01:59:21 +08:00
|
|
|
|
public Task WaitForEnterAsync() => _completionSource.Task;
|
|
|
|
|
|
|
|
|
|
|
|
private void OnEnterClick(object? sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
_completionSource.TrySetResult(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|