Table of Contents

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

T

Any 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

documentBrowserCaption string

The caption of the document browser.

selectionMethod Func<T, bool>

Optional method to decide for any given document whether it shall be visible in the document browser (true) or not (false).

returnReference bool

By default a deep copy of the selected document is returned. However, if this optional parameter is set to true only a reference is returned.

Returns

T

The matching document. Null if 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

index int

By 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.

selectionMethod Func<T, bool>

Optional method to decide for any given document whether it shall be chosen (true) or not (false).

returnReference bool

By default a deep copy of the selected document is returned. However, if this optional parameter is set to true only 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

selectionMethod Func<T, bool>

Optional additional constraints that the documents must fulfill.

Returns

int

The number of documents which fulfill the condition.