Table of Contents

Class PresetList

Namespace
PluginUI
Assembly
PluginUI.dll

In-memory IPresetProvider: the application supplies the load/capture callbacks (Loading, Capture) and persists Entries as it likes.

public sealed class PresetList : IPresetProvider
Inheritance
PresetList
Implements
Inherited Members

Constructors

PresetList()

Creates an empty list.

public PresetList()

PresetList(IEnumerable<PresetEntry>)

Creates a list from entries.

public PresetList(IEnumerable<PresetEntry> entries)

Parameters

entries IEnumerable<PresetEntry>

Properties

CanSave

true if Save(string) is supported.

public bool CanSave { get; }

Property Value

bool

Capture

Called to capture the current state when saving (returns the payload).

[Browsable(false)]
public Func<object?>? Capture { get; set; }

Property Value

Func<object>

Count

Number of presets.

public int Count { get; }

Property Value

int

CurrentIndex

Index of the loaded preset (−1 = none).

public int CurrentIndex { get; }

Property Value

int

Entries

Entries.

public IReadOnlyList<PresetEntry> Entries { get; }

Property Value

IReadOnlyList<PresetEntry>

IsModified

true if parameters changed since the preset was loaded.

public bool IsModified { get; }

Property Value

bool

Loading

Called to apply a preset (index, entry).

[Browsable(false)]
public Action<int, PresetEntry>? Loading { get; set; }

Property Value

Action<int, PresetEntry>

UserBank

Bank assigned to presets saved by the user.

public string? UserBank { get; set; }

Property Value

string

Methods

Add(PresetEntry)

Adds an entry.

public void Add(PresetEntry entry)

Parameters

entry PresetEntry

CanDelete(int)

true if the preset can be deleted (user presets).

public bool CanDelete(int index)

Parameters

index int

Returns

bool

Delete(int)

Deletes a preset.

public void Delete(int index)

Parameters

index int

GetBank(int)

Bank / category of a preset (null = no grouping).

public string? GetBank(int index)

Parameters

index int

Returns

string

GetName(int)

Name of a preset.

public string GetName(int index)

Parameters

index int

Returns

string

Load(int)

Loads a preset.

public void Load(int index)

Parameters

index int

MarkModified()

Marks the current preset as modified (call when a parameter changes).

public void MarkModified()

Save(string)

Saves the current state under name (overwrites a preset with the same name); returns its index.

public int Save(string name)

Parameters

name string

Returns

int

Events

Changed

Raised when the list, the current index or the modified flag changes.

public event Action<IPresetProvider>? Changed

Event Type

Action<IPresetProvider>