GH_DocumentServer

References
Manages and maintains a collection of GH_Documents.

Properties

DocumentCount

#
Gets the number of documents stored in the global list.
public int DocumentCount { get; }

DocumentNames

#
Gets a string collection containing all the names of the documents in the global list.
public List<string> DocumentNames { get; }

ModifiedDocumentCount

#
Gets the total number of modified (unsaved) documents.
public int ModifiedDocumentCount { get; }

Indexers

Document

#
Gets the document at the given index.
public GH_Document this[
index
Index of document to retrieve.
] { get; }

Methods

AddDocument

#
Add a new document to the global list. If there already is a document with the given path, it will be made active.
public GH_Document AddDocument(
filepath,
Filepath to document.
makeActive
If true, the document will be loaded into the main canvas.
)
The document that was added or activated, or null on failure.

AddDocument

#
Add a new document to the global list. If the document is already registered nothing will happen. This also applies to a different document which points to the same file path
public void AddDocument(
document,
Document to add.
ref bool
success
)
ArgumentNullExceptionThrown when the document is a null reference.
InvalidOperationExceptionThrown when the document doesn't have top-level rank.

AddDocument

#
Add a new document to the global list. If the document is already registered nothing will happen. This also applies to a different document which points to the same file path
public void AddDocument(
document
Document to add.
)
ArgumentNullExceptionThrown when the document is a null reference.
InvalidOperationExceptionThrown when the document doesn't have top-level rank.

AddNewDocument

#
Adds a new document to the global list. If a template file has been set, this document will be based on the template.
public GH_Document AddNewDocument()
The document thaw was added.

Contains

#
Gets a value indicating whether or not the given document is inside the list.
public bool Contains()

GetEnumerator

#
public IEnumerator GetEnumerator()

GetEnumerator_Generic

#
public IEnumerator<GH_Document> GetEnumerator_Generic()

IndexOf

#
Gets the index of the given document.
public int IndexOf(
doc
Document to search for.
)
The index of the given document or -1 if the document is not in the global list.

IndexOf

#
Gets the index of the document that matches the filepath.
public int IndexOf(
filepath
File path URI to match.
)
The index of the document that matches the given path or -1 if no document match is found.

IndexOfAutoSave

#
Gets the document index that is associated with the specified autosave location.
public int IndexOfAutoSave(
autoSavePath
The full path (directory, filename and extension) of the autosave file to test against.
)
The index of the document that matches the given autosave path or -1 if no document match is found.

NextAvailableDocument

#
Gets the most important, non-active document.
public GH_Document NextAvailableDocument()

PromoteDocument

#
Push a document to the top of the list, meaning it will be first in line when a new default document needs to be selected.
public void PromoteDocument(
document
Document to promote.
)

RemoveAllDocuments

#
Remove all documents in the global list.
public void RemoveAllDocuments()

RemoveDocument

#
Removes a specific document from the global list. If the document isn't registered nothing will happen. If the document is owned by an IGH_DocumentOwner, the owner will be informed of the removal.
public void RemoveDocument(
document
Document to remove.
)

SafeRemoveDocument

#
Remove a document correctly from the server. This method shows user-interface prompts if there is unsaved data and will also save if needed.
public bool SafeRemoveDocument(
document
Document to remove.
)
True if the document was removed, false if otherwise.

Events

DocumentAdded

#
public event GH_DocumentServer.DocumentAddedEventHandler DocumentAdded

DocumentRemoved

#
public event GH_DocumentServer.DocumentRemovedEventHandler DocumentRemoved