Class DocumentHistory<T>
- Namespace
- VirtualLabAPI.Core.Common
- Assembly
- VirtualLabAPI.dll
This generic class provides access to recently used documents.
public static class DocumentHistory<T> where T : IDocument
Type Parameters
TAny type derived from IDocument is supported.
- Inheritance
-
DocumentHistory<T>
- Inherited Members
Methods
BrowseDocuments(string, Func<T, bool>, bool)
Allows the user to select a document from a document browser showing only specific document windows.
public static T BrowseDocuments(string documentBrowserCaption, Func<T, bool> selectionMethod = null, bool returnReference = false)
Parameters
documentBrowserCaptionstringThe caption of the document browser.
selectionMethodFunc<T, bool>Optional method to decide for any given document whether it shall be visible in the document browser (
true) or not (false).returnReferenceboolBy default a deep copy of the selected document is returned. However, if this optional parameter is set to
trueonly a reference is returned.
Returns
- T
The matching document.
Nullif the user closed the document browser.
GetLastDocument(int, Func<T, bool>, bool)
Returns a document which fulfills the given condition.
public static T GetLastDocument(int index = 0, Func<T, bool> selectionMethod = null, bool returnReference = false)
Parameters
indexintBy default the most recently selected document matching the selection method is returned. But if you want e.g. the most recent but one you can set the index to 1 and so on.
selectionMethodFunc<T, bool>Optional method to decide for any given document whether it shall be chosen (
true) or not (false).returnReferenceboolBy default a deep copy of the selected document is returned. However, if this optional parameter is set to
trueonly a reference is returned.
Returns
- T
The matching document.
GetNumberOfDocuments(Func<T, bool>)
Gets the number of documents which fulfill the given condition.
public static int GetNumberOfDocuments(Func<T, bool> selectionMethod = null)
Parameters
Returns
- int
The number of documents which fulfill the condition.