Class LibraryCatalogueScope
- Namespace
- EncDotNet.S100.Collections.Library
- Assembly
- EncDotNet.S100.Collections.dll
What part of an online catalogue a new Library source includes (#792): the catalogue as read, its choices, what the ticked choices amount to, and the source they make. One per catalogue kind; the viewer's Add-to-Library dialog and headless hosts share them.
public abstract class LibraryCatalogueScope
- Inheritance
-
LibraryCatalogueScope
- Derived
- Inherited Members
Constructors
LibraryCatalogueScope(Uri)
Creates a scope for the catalogue at catalogUri.
protected LibraryCatalogueScope(Uri catalogUri)
Parameters
catalogUriUriThe catalogue's URL.
Properties
CanBuild
True when the source can be built (by default, once the catalogue is read).
public virtual bool CanBuild { get; }
Property Value
CatalogUri
The catalogue's URL.
public Uri CatalogUri { get; }
Property Value
CatalogueDate
The date the catalogue declares, once read.
public DateOnly? CatalogueDate { get; protected set; }
Property Value
Choices
Every choice across the groups.
public IEnumerable<LibraryChoice> Choices { get; }
Property Value
EverythingSummary
"12,345 cells · 1.2 GB" for the whole catalogue.
public abstract string EverythingSummary { get; }
Property Value
Groups
The choice groups, once the catalogue has been read.
public abstract IReadOnlyList<LibraryChoiceGroup> Groups { get; }
Property Value
IncludeAll
True to include the whole catalogue whatever is ticked (the default); false to include only the ticked choices.
public bool IncludeAll { get; set; }
Property Value
IsEverything
True when the source will include everything: the suggested name is then the catalogue's alone.
public virtual bool IsEverything { get; }
Property Value
IsLoaded
True once the catalogue has been read.
public abstract bool IsLoaded { get; }
Property Value
IsUnscoped
True when nothing is ticked (the selection means the whole catalogue).
public bool IsUnscoped { get; }
Property Value
Name
The catalogue's own name, when it has one (a manifest's title); otherwise null.
public virtual string? Name { get; }
Property Value
ScopeSummary
The summary under the choices: what is included, that ticks are kept, or a prompt to tick something.
public virtual string ScopeSummary { get; }
Property Value
SelectedCount
How many choices are ticked.
public int SelectedCount { get; }
Property Value
SelectionSummary
What the ticked choices (or, with none, the whole catalogue) amount to, e.g. "12 cells · 3 MB".
public abstract string SelectionSummary { get; }
Property Value
SingleEntry
The catalogue's only download, when it lists just one (there is nothing to choose); otherwise null.
public abstract LibraryChoice? SingleEntry { get; }
Property Value
Methods
Build(Guid, string?)
The source the scope describes.
public abstract CollectionSource Build(Guid id, string? name)
Parameters
idGuidThe new source's id.
namestringThe source's name when everything is included (the catalogue's name); a selection names it after the selection. A manifest source always takes it.
Returns
DescribeSelection()
Describes the ticked choices ("Alaska, Hawaii"), or null when nothing is ticked.
public abstract string? DescribeSelection()
Returns
LoadAsync(CancellationToken)
Reads the catalogue and creates its choices.
public abstract Task<string?> LoadAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the read.
Returns
OnChanged()
Raises Changed.
protected void OnChanged()
Size(long?)
"Download (1.7 MB)"-style size text for a single entry, or empty when unknown.
protected static string Size(long? bytes)
Parameters
byteslong?
Returns
TryLoadAsync(Func<Task>)
Runs load, turning the expected failures of reading a catalogue into a message.
protected static Task<string?> TryLoadAsync(Func<Task> load)
Parameters
Returns
Events
Changed
Raised when something the scope shows changed on its own (sizes arriving after a listing).
public event EventHandler? Changed