Ionite
1 year ago
2 changed files with 73 additions and 0 deletions
@ -0,0 +1,57 @@
|
||||
using System; |
||||
using StabilityMatrix.Avalonia.Services; |
||||
using StabilityMatrix.Avalonia.ViewModels.Base; |
||||
using StabilityMatrix.Avalonia.ViewModels.Inference; |
||||
using StabilityMatrix.Core.Models.Base; |
||||
|
||||
namespace StabilityMatrix.Avalonia.Models.Inference; |
||||
|
||||
public record EditableModule : StringValue |
||||
{ |
||||
public static readonly EditableModule FreeU = |
||||
new( |
||||
"FreeU", |
||||
builder => |
||||
builder.Get<StackExpanderViewModel>(vm => |
||||
{ |
||||
vm.Title = "FreeU"; |
||||
vm.AddCards(builder.Get<FreeUCardViewModel>()); |
||||
}) |
||||
); |
||||
|
||||
public static readonly EditableModule HiresFix = |
||||
new( |
||||
"HiresFix", |
||||
builder => |
||||
builder.Get<StackExpanderViewModel>(vm => |
||||
{ |
||||
vm.Title = "HiresFix"; |
||||
vm.AddCards( |
||||
builder.Get<UpscalerCardViewModel>(), |
||||
builder.Get<SamplerCardViewModel>(vmSampler => |
||||
{ |
||||
vmSampler.IsDenoiseStrengthEnabled = true; |
||||
}) |
||||
); |
||||
}) |
||||
); |
||||
|
||||
public static readonly EditableModule Upscaler = |
||||
new( |
||||
"Upscaler", |
||||
builder => |
||||
builder.Get<StackExpanderViewModel>(vm => |
||||
{ |
||||
vm.Title = "Upscaler"; |
||||
vm.AddCards(builder.Get<UpscalerCardViewModel>()); |
||||
}) |
||||
); |
||||
|
||||
public Func<ServiceManager<ViewModelBase>, ViewModelBase> Build { get; } |
||||
|
||||
private EditableModule(string value, Func<ServiceManager<ViewModelBase>, ViewModelBase> build) |
||||
: base(value) |
||||
{ |
||||
Build = build; |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
namespace StabilityMatrix.Core.Models.Base; |
||||
|
||||
/// <summary> |
||||
/// Base class for a string value object |
||||
/// </summary> |
||||
/// <param name="Value">String value</param> |
||||
public abstract record StringValue(string Value) |
||||
{ |
||||
/// <inheritdoc /> |
||||
public override string ToString() |
||||
{ |
||||
return Value; |
||||
} |
||||
|
||||
public static implicit operator string(StringValue stringValue) => stringValue.ToString(); |
||||
} |
Loading…
Reference in new issue