using System.Collections.Generic; using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models.Inference; using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.ViewModels.Base; namespace StabilityMatrix.Avalonia.ViewModels.Inference.Modules; public abstract class ModuleBase : StackExpanderViewModel, IComfyStep, IInputImageProvider { protected readonly ServiceManager VmFactory; /// protected ModuleBase(ServiceManager vmFactory) : base(vmFactory) { VmFactory = vmFactory; } /// public void ApplyStep(ModuleApplyStepEventArgs e) { if (e.IsEnabledOverrides.TryGetValue(GetType(), out var isEnabledOverride)) { if (isEnabledOverride) { OnApplyStep(e); } return; } if (!IsEnabled) { return; } OnApplyStep(e); } protected abstract void OnApplyStep(ModuleApplyStepEventArgs e); /// IEnumerable IInputImageProvider.GetInputImages() => GetInputImages(); protected virtual IEnumerable GetInputImages() { yield break; } }