mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-12 07:36:59 +00:00
further simplify pagebuilding by embedding the desired title locale key in the context base type
This commit is contained in:
parent
a336bb0568
commit
327cdb825a
5 changed files with 22 additions and 12 deletions
|
|
@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.SetupWizard.Pages
|
namespace Ryujinx.Ava.UI.SetupWizard.Pages
|
||||||
{
|
{
|
||||||
public partial class SetupFirmwarePageContext : SetupWizardPageContext
|
public partial class SetupFirmwarePageContext() : SetupWizardPageContext(LocaleKeys.SetupWizardFirmwarePageTitle)
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string FirmwareSourcePath { get; set; }
|
public partial string FirmwareSourcePath { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.SetupWizard.Pages
|
namespace Ryujinx.Ava.UI.SetupWizard.Pages
|
||||||
{
|
{
|
||||||
public partial class SetupKeysPageContext : SetupWizardPageContext
|
public partial class SetupKeysPageContext() : SetupWizardPageContext(LocaleKeys.SetupWizardKeysPageTitle)
|
||||||
{
|
{
|
||||||
public override Result CompleteStep() =>
|
public override Result CompleteStep() =>
|
||||||
!Directory.Exists(KeysFolderPath)
|
Directory.Exists(KeysFolderPath)
|
||||||
? Result.Fail
|
? InstallKeys(KeysFolderPath)
|
||||||
: InstallKeys(KeysFolderPath);
|
: Result.Fail;
|
||||||
|
|
||||||
public override object CreateHelpContent()
|
public override object CreateHelpContent()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,7 @@ namespace Ryujinx.Ava.UI.SetupWizard
|
||||||
if (_overwrite || !RyujinxApp.MainWindow.VirtualFileSystem.HasKeySet)
|
if (_overwrite || !RyujinxApp.MainWindow.VirtualFileSystem.HasKeySet)
|
||||||
{
|
{
|
||||||
Retry:
|
Retry:
|
||||||
bool result = await NextPage()
|
bool result = await NextPage<SetupKeysPage, SetupKeysPageContext>(out SetupKeysPageContext keyContext)
|
||||||
.WithTitle(LocaleKeys.SetupWizardKeysPageTitle)
|
|
||||||
.WithContent<SetupKeysPage, SetupKeysPageContext>(out SetupKeysPageContext keyContext)
|
|
||||||
.Show();
|
.Show();
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -37,9 +35,7 @@ namespace Ryujinx.Ava.UI.SetupWizard
|
||||||
}
|
}
|
||||||
|
|
||||||
Retry:
|
Retry:
|
||||||
bool result = await NextPage()
|
bool result = await NextPage<SetupFirmwarePage, SetupFirmwarePageContext>(out SetupFirmwarePageContext fwContext)
|
||||||
.WithTitle(LocaleKeys.SetupWizardFirmwarePageTitle)
|
|
||||||
.WithContent<SetupFirmwarePage, SetupFirmwarePageContext>(out SetupFirmwarePageContext fwContext)
|
|
||||||
.Show();
|
.Show();
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Ryujinx.Ava.Common;
|
using Ryujinx.Ava.Common;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Systems.Configuration;
|
using Ryujinx.Ava.Systems.Configuration;
|
||||||
|
using Ryujinx.Ava.UI.Controls;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -37,6 +38,13 @@ namespace Ryujinx.Ava.UI.SetupWizard
|
||||||
|
|
||||||
private SetupWizardPage NextPage() => new(_window.WizardPresenter, this);
|
private SetupWizardPage NextPage() => new(_window.WizardPresenter, this);
|
||||||
|
|
||||||
|
private SetupWizardPage NextPage<TControl, TContext>(out TContext boundContext)
|
||||||
|
where TControl : RyujinxControl<TContext>, new()
|
||||||
|
where TContext : SetupWizardPageContext, new()
|
||||||
|
=> NextPage()
|
||||||
|
.WithContent<TControl, TContext>(out boundContext)
|
||||||
|
.WithTitle(boundContext.Title);
|
||||||
|
|
||||||
public void SignalConfigModified()
|
public void SignalConfigModified()
|
||||||
{
|
{
|
||||||
_configWasModified = true;
|
_configWasModified = true;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
using Gommon;
|
using Gommon;
|
||||||
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.SetupWizard
|
namespace Ryujinx.Ava.UI.SetupWizard
|
||||||
{
|
{
|
||||||
public abstract class SetupWizardPageContext : BaseModel
|
public abstract class SetupWizardPageContext(LocaleKeys title) : BaseModel
|
||||||
{
|
{
|
||||||
|
public LocaleKeys Title => title;
|
||||||
|
|
||||||
public RyujinxNotificationManager NotificationManager { get; init; }
|
public RyujinxNotificationManager NotificationManager { get; init; }
|
||||||
|
|
||||||
|
// ReSharper disable once UnusedMemberInSuper.Global
|
||||||
|
// it's used implicitly as we use this type as a where guard for generics for WithContent<TControl, TContext>,
|
||||||
|
// it also ensures all context types implement completion
|
||||||
public abstract Result CompleteStep();
|
public abstract Result CompleteStep();
|
||||||
#nullable enable
|
#nullable enable
|
||||||
public virtual object? CreateHelpContent()
|
public virtual object? CreateHelpContent()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue