SelectionSlots¶
Namespace:
SideXP.Selection
Numbered slots where selections can be saved and restored later. The slots are personal, and saved on disk after each change.
Properties¶
Count¶
The number of slots.
Events¶
OnChanged¶
Called when a slot has been assigned, replaced, cleared or cleaned.
Methods¶
IsAssigned(int)¶
Checks if a selection is saved in the given slot.
Parameters
index: The index of the slot.
Returns
Returns true if the slot is assigned.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Get(int)¶
Gets the selection saved in the given slot.
Parameters
index: The index of the slot.
Returns
Returns the saved selection, or null if the slot is not assigned.
Assign(int)¶
Saves the current selection in the given slot, replacing the previous one if any.
Parameters
index: The index of the slot.
Returns
Returns true if the selection has been saved, or false if the current selection is empty.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Assign(int, IEnumerable<Object>, Object)¶
Saves the given selection in the given slot, replacing the previous one if any.
Parameters
index: The index of the slot.objects: The objects to save. Null entries and duplicates are ignored.activeObject: The active object of the selection. Ignored if it's not one of the given objects.
Returns
Returns true if the selection has been saved, or false if there's no object to save.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Assign(int, SelectionSnapshot)¶
Saves a copy of the given selection in the given slot, replacing the previous one if any.
Parameters
index: The index of the slot.snapshot: The selection to save (for example, an entry of Entries).
Returns
Returns true if the selection has been saved, or false if it's empty.
Exceptions
ArgumentNullException: Thrown if the given snapshot is null.ArgumentOutOfRangeException: Thrown if the index is out of range.
Remarks
Objects that can't be resolved (for example, objects in a scene that is not loaded) are saved as well, which is not the case when saving resolved objects with Assign.
Restore(int)¶
Selects the objects saved in the given slot. Objects that can't be resolved are skipped, and a warning is logged to list them.
Parameters
index: The index of the slot.
Returns
Returns true if the selection has been restored, or false if the slot is not assigned or none of its objects can be resolved.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
AssignOrRestore(int)¶
Restores the selection saved in the given slot if it's assigned, or saves the current selection in it otherwise.
Parameters
index: The index of the slot.
Returns
Returns true if the selection has been restored or saved.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Clear(int)¶
Unassigns the given slot.
Parameters
index: The index of the slot.
Returns
Returns true if the slot was assigned.
ClearAll()¶
Unassigns all the slots.
Clean()¶
Removes the objects that don't exist anymore from the saved selections. A slot that becomes empty is unassigned.
Returns
Returns true if at least one object has been removed.
RefreshReferences()¶
Captures again the identifiers of the objects that are still alive in all the slots.