mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-12 22:36:59 +00:00
Initial work on a setup wizard
Setup wizard abstraction & architecture from TKMM
This commit is contained in:
parent
52700f71dc
commit
aee46e16cd
19 changed files with 743 additions and 10 deletions
62
src/Ryujinx/Systems/SetupWizard/SetupWizardPage.cs
Normal file
62
src/Ryujinx/Systems/SetupWizard/SetupWizardPage.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using Avalonia.Controls.Presenters;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Systems.SetupWizard;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.SetupWizard
|
||||
{
|
||||
public partial class SetupWizardPage(bool isFirstPage = false) : BaseModel
|
||||
{
|
||||
protected bool? _result;
|
||||
protected readonly CancellationTokenSource _cancellationTokenSource = new();
|
||||
|
||||
public bool IsFirstPage { get; } = isFirstPage;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _title;
|
||||
|
||||
[ObservableProperty]
|
||||
private object? _content;
|
||||
|
||||
[ObservableProperty]
|
||||
private object? _helpContent;
|
||||
|
||||
[ObservableProperty]
|
||||
private object? _actionContent = LocaleManager.Instance[LocaleKeys.SetupWizardActionNext];
|
||||
|
||||
[RelayCommand]
|
||||
private void MoveBack()
|
||||
{
|
||||
_result = false;
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void MoveNext()
|
||||
{
|
||||
_result = true;
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
public async ValueTask<bool> Show(ContentPresenter presenter)
|
||||
{
|
||||
presenter.Content = new SetupWizardPageView
|
||||
{
|
||||
DataContext = this,
|
||||
};
|
||||
|
||||
try {
|
||||
await Task.Delay(-1, _cancellationTokenSource.Token);
|
||||
}
|
||||
catch (TaskCanceledException) {
|
||||
return _result ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue