mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-04-27 17:12:55 +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:
65
src/Ryujinx/UI/SetupWizard/SetupWizardPage.Builder.cs
Normal file
65
src/Ryujinx/UI/SetupWizard/SetupWizardPage.Builder.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
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.NotificationHelper };
|
||||
|
||||
return WithContent<TControl>(boundViewModel);
|
||||
}
|
||||
|
||||
public SetupWizardPage WithActionContent(LocaleKeys content) =>
|
||||
WithActionContent(LocaleManager.Instance[content]);
|
||||
|
||||
public SetupWizardPage WithActionContent(object? content)
|
||||
{
|
||||
ActionContent = content;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user