Files
ryujinx/src/Ryujinx/UI/SetupWizard/SetupWizardPage.Builder.cs
GreemDev 3fe7600382 add "overwrite mode" for the setup wizard, basically this just ignores the precondition of having whatever the page configures before showing it.
i.e. if you had keys installed, previously it'd skip right to firmware.

additionally added more customization to the now instance-based NotificationHelper
2025-12-19 23:15:23 -06:00

66 lines
1.9 KiB
C#

using Avalonia;
using Avalonia.Controls;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Controls;
namespace Ryujinx.Ava.UI.SetupWizard
{
public partial class SetupWizardPage
{
public SetupWizardPage WithTitle(LocaleKeys title) => WithTitle(LocaleManager.Instance[title]);
public SetupWizardPage WithTitle(string title)
{
Title = title;
return this;
}
public SetupWizardPage WithContent(LocaleKeys content) => WithContent(LocaleManager.Instance[content]);
public SetupWizardPage WithContent(object? content)
{
if (content is StyledElement { Parent: ContentControl parent })
{
parent.Content = null;
}
Content = content;
return this;
}
public SetupWizardPage WithHelpContent(LocaleKeys content) =>
WithHelpContent(LocaleManager.Instance[content]);
public SetupWizardPage WithHelpContent(object? content)
{
HelpContent = content;
return this;
}
public SetupWizardPage WithContent<TControl>(object? context = null) where TControl : Control, new()
{
Content = new TControl { DataContext = context };
return this;
}
public SetupWizardPage WithContent<TControl, TViewModel>(out TViewModel boundViewModel)
where TControl : RyujinxControl<TViewModel>, new()
where TViewModel : SetupWizardPageContext, new()
{
boundViewModel = new() { Notifications = ownerWizard.Notification };
return WithContent<TControl>(boundViewModel);
}
public SetupWizardPage WithActionContent(LocaleKeys content) =>
WithActionContent(LocaleManager.Instance[content]);
public SetupWizardPage WithActionContent(object? content)
{
ActionContent = content;
return this;
}
}
}