2026-03-09 12:27:33 +08:00
|
|
|
using Avalonia.Controls;
|
|
|
|
|
|
|
|
|
|
namespace LanMountainDesktop.PluginSdk;
|
|
|
|
|
|
|
|
|
|
public sealed class PluginSettingsPageRegistration
|
|
|
|
|
{
|
|
|
|
|
public PluginSettingsPageRegistration(
|
|
|
|
|
string id,
|
|
|
|
|
string title,
|
2026-03-12 09:22:03 +08:00
|
|
|
Func<IServiceProvider, Control> contentFactory,
|
2026-03-09 12:27:33 +08:00
|
|
|
int sortOrder = 0)
|
|
|
|
|
{
|
|
|
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(id);
|
|
|
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(title);
|
|
|
|
|
ArgumentNullException.ThrowIfNull(contentFactory);
|
|
|
|
|
|
|
|
|
|
Id = id.Trim();
|
|
|
|
|
Title = title.Trim();
|
|
|
|
|
ContentFactory = contentFactory;
|
|
|
|
|
SortOrder = sortOrder;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 09:22:03 +08:00
|
|
|
public PluginSettingsPageRegistration(
|
|
|
|
|
string id,
|
|
|
|
|
string title,
|
|
|
|
|
Func<Control> contentFactory,
|
|
|
|
|
int sortOrder = 0)
|
|
|
|
|
: this(id, title, _ => contentFactory(), sortOrder)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 12:27:33 +08:00
|
|
|
public string Id { get; }
|
|
|
|
|
|
|
|
|
|
public string Title { get; }
|
|
|
|
|
|
|
|
|
|
public int SortOrder { get; }
|
|
|
|
|
|
2026-03-12 09:22:03 +08:00
|
|
|
public Func<IServiceProvider, Control> ContentFactory { get; }
|
2026-03-09 12:27:33 +08:00
|
|
|
}
|