mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-19 19:36:58 +00:00
Setup Wizard restructuring
- Remove polymorphic base, this only existed because TKMM has a desktop/switch setup prodecure difference and has 2 implementations of the setup wizard. We only need one. - Remove Systems/UI file split, they're all in Ryujinx.Ava.UI now - made NotificationHelper instance-based to allow you to encapsulate notifications to a window that magically disappear when the window is closed, instead of switching to showing on the main window.
This commit is contained in:
parent
3202ec72b2
commit
8d9d6b1afc
18 changed files with 123 additions and 84 deletions
59
src/Ryujinx/UI/SetupWizard/SetupWizardPage.cs
Normal file
59
src/Ryujinx/UI/SetupWizard/SetupWizardPage.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
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 { get; } = isFirstPage;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string? Title { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial object? Content { get; set; }
|
||||
|
||||
[ObservableProperty] public partial object? HelpContent { get; set; }
|
||||
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue