Files
ryujinx/src/Ryujinx/UI/SetupWizard/SetupWizardPage.cs
GreemDev e12a77d4a3 add a setup finished screen
added the ability to hide the help button (basically just for the finish screen, because it has a bigger discord button in the same place)
holding shift while opening the setup wizard now opens it in passive mode, aka it will install only what you need. this is mostly for testing and likely will be nuked before this code as a whole is made part of the official emulator, but it might not
2025-12-19 23:15:23 -06:00

67 lines
1.8 KiB
C#

using Avalonia.Controls.Presenters;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.ViewModels;
using System.Threading;
using System.Threading.Tasks;
namespace Ryujinx.Ava.UI.SetupWizard
{
public partial class SetupWizardPage(
ContentPresenter contentPresenter,
RyujinxSetupWizard ownerWizard,
bool isFirstPage = false) : BaseModel
{
private bool? _result;
private readonly CancellationTokenSource _cts = new();
public bool IsFirstPage => isFirstPage;
public RyujinxSetupWizard Parent => ownerWizard;
[ObservableProperty] public partial string? Title { get; set; }
[ObservableProperty] public partial object? Content { get; set; }
[ObservableProperty] public partial object? HelpContent { get; set; }
[ObservableProperty] public partial bool HasHelpContent { get; set; }
[ObservableProperty] public partial bool ShowHelpButton { get; set; } = true;
[ObservableProperty]
public partial object? ActionContent { get; set; } = LocaleManager.Instance[LocaleKeys.SetupWizardActionNext];
[RelayCommand]
private void MoveBack()
{
_result = false;
_cts.Cancel();
}
[RelayCommand]
private void MoveNext()
{
_result = true;
_cts.Cancel();
}
public async ValueTask<bool> Show()
{
contentPresenter.Content = new SetupWizardPageView { ViewModel = this };
try
{
await Task.Delay(-1, _cts.Token);
}
catch (TaskCanceledException)
{
return _result ?? false;
}
return false;
}
}
}