C# Class Dynamo.Models.DynamoModel

The Dynamo model.
Inheritance: Dynamo.Models.ModelBase
显示文件 Open project: DynamoDS/Dynamo Class Usage Examples

Public Properties

Property Type Description
Context string
CustomNodeManager Dynamo.Utilities.CustomNodeManager
DebugSettings DebugSettings
LibraryServices LibraryServices
Loader NodeModelAssemblyLoader
Logger DynamoLogger
MigrationManager Dynamo.Models.MigrationManager
NodeFactory NodeFactory
PreferenceSettings PreferenceSettings
SearchModel NodeSearchModel

Private Properties

Property Type Description
AddNodeToCurrentWorkspace void
AddNodeTypeToSearch void
AddToGroup void
AddZeroTouchNodeToSearch void
AddZeroTouchNodeToSearch void
AddZeroTouchNodesToSearch void
CanDumpLibraryToXml bool
CreateOrLoadPreferences IPreferences
DeleteModelInternal void
DisplayEngineFailureMessage Dynamo.Models.TaskDialogEventArgs
DisplayFutureFileMessage bool
DisplayObsoleteFileMessage void
DumpLibrarySnapshot void
DumpLibraryToXml void
EngineController_TraceReconcliationComplete void
HideUnhideNamespace void
InitializeCustomNodeManager void
InitializeIncludedNodes void
InitializeInstrumentationLogger void
InitializeNodeLibrary void
InitializePreferences void
LibraryLoaded void
LoadExtensions IEnumerable
LoadNodeLibrary void
LogMessage void
LogWarningMessage void
MarkAllDependenciesAsModified void
OnAsyncTaskStateChanged void
OnRequestPresetNamePrompt void
OnRequestsFunctionNamePrompt void
OnShutdownCompleted void
OnShutdownStarted void
OnWorkspaceOpening void
OnWorkspacePropertyChanged void
OnWorkspaceSaved void
OpenFile bool
OpenHomeWorkspace bool
PostUIActivation void
PreferenceSettings_PropertyChanged void
RegisterCustomNodeDefinitionWithEngine void
RegisterHomeWorkspace void
RemoveExtension void
StartBackupFilesTimer void
UngroupModel void
UpdateCustomNodeDefinition void
UpdateManager_Log void

Public Methods

Method Description
AddCustomNodeWorkspace ( Dynamo.Models.CustomNodeWorkspaceModel workspace ) : void

Add a new, visible Custom Node workspace to Dynamo

AddHomeWorkspace ( ) : void

Add a new HomeWorkspace and set as current

AddToSelection ( object parameters ) : void

Add an ISelectable object to the selection.

AddWorkspace ( Dynamo.Models.WorkspaceModel workspace ) : void

Adds a workspace to the dynamo model.

ClearCurrentWorkspace ( ) : void

Clear the workspace. Removes all nodes, notes, and connectors from the current workspace.

Copy ( ) : void

Copy selected ISelectable objects to the clipboard.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ForceRun ( ) : void

Forces an evaluation of the current workspace by resetting the DesignScript VM.

OpenCustomNodeWorkspace ( System.Guid guid ) : bool

Opens an existing custom node workspace.

OpenFileFromPath ( string xmlPath, bool forceManualExecutionMode = false ) : void

Opens a Dynamo workspace from a path to an Xml file on disk.

Paste ( ) : void

Paste ISelectable objects from the clipboard to the workspace so that the nodes appear in their original location with a slight offset

Paste ( Dynamo.Utilities.Point2D targetPoint, bool useOffset = true ) : void

Paste ISelectable objects from the clipboard to the workspace at specified point.

PostTraceReconciliation ( Dictionary orphanedSerializables ) : void

Deals with orphaned serializables.

RemoveWorkspace ( Dynamo.Models.WorkspaceModel workspace ) : void

Remove a workspace from the dynamo model.

ResetEngine ( bool markNodesAsDirty = false ) : void

Call this method to reset the virtual machine, avoiding a race condition by using a thread join inside the vm executive.

ShutDown ( bool shutdownHost ) : void

External components call this method to shutdown DynamoModel. This method marks 'ShutdownRequested' property to 'true'. This method is used rather than a public virtual method to ensure that the value of ShutdownRequested is set to true.

Start ( ) : DynamoModel

Start DynamoModel with all default configuration options

Start ( IStartConfiguration configuration ) : DynamoModel

Start DynamoModel with custom configuration. Defaults will be assigned not provided.

Protected Methods

Method Description
DynamoModel ( IStartConfiguration config ) : Dynamo.Configuration

Default constructor for DynamoModel

PostShutdownCore ( bool shutdownHost ) : void
PreShutdownCore ( bool shutdownHost ) : void
ResetEngineInternal ( ) : void
SaveBackupFiles ( object state ) : void

Backup all the files

ShutDownCore ( bool shutdownHost ) : void

Private Methods

Method Description
AddNodeToCurrentWorkspace ( Dynamo.Models.NodeModel node, bool centered, bool addToSelection = true ) : void

Adds a node to the current workspace.

AddNodeTypeToSearch ( Dynamo.Models.TypeLoadData typeLoadData ) : void
AddToGroup ( List modelsToAdd ) : void
AddZeroTouchNodeToSearch ( Dynamo.DSEngine.FunctionDescriptor functionDescriptor ) : void
AddZeroTouchNodeToSearch ( Dynamo.Engine.FunctionGroup funcGroup ) : void
AddZeroTouchNodesToSearch ( IEnumerable functionGroups ) : void
CanDumpLibraryToXml ( object obj ) : bool
CreateOrLoadPreferences ( IPreferences preferences ) : IPreferences
DeleteModelInternal ( List modelsToDelete ) : void
DisplayEngineFailureMessage ( Exception exception ) : Dynamo.Models.TaskDialogEventArgs

Call this method to display an error message in an event when live runner throws an exception that is not handled anywhere else. This message instructs user to save their work and restart Dynamo.

DisplayFutureFileMessage ( string fullFilePath, System.Version fileVersion, System.Version currVersion ) : bool

Displays file open error dialog if the file is of a future version than the currently installed version

DisplayObsoleteFileMessage ( string fullFilePath, System.Version fileVersion, System.Version currVersion ) : void

Call this method to display a message box when a file of an older version cannot be opened by the current version of Dynamo.

DumpLibrarySnapshot ( IEnumerable functionGroups ) : void
DumpLibraryToXml ( object parameter ) : void
EngineController_TraceReconcliationComplete ( Dynamo.DSEngine.TraceReconciliationEventArgs obj ) : void
HideUnhideNamespace ( bool hide, string library, string namespc ) : void

This method updates the node search library to either hide or unhide nodes that belong to a specified assembly name and namespace. These nodes will be hidden from the node library sidebar and from the node search.

InitializeCustomNodeManager ( ) : void
InitializeIncludedNodes ( ) : void
InitializeInstrumentationLogger ( ) : void
InitializeNodeLibrary ( IPreferences preferences ) : void
InitializePreferences ( IPreferences preferences ) : void
LibraryLoaded ( object sender, LibraryServices e ) : void

LibraryLoaded event handler.

LoadExtensions ( ) : IEnumerable
LoadNodeLibrary ( Assembly assem ) : void
LogMessage ( ILogMessage obj ) : void
LogWarningMessage ( LogWarningMessageEventArgs args ) : void

This warning message is displayed on the node associated with the FFI dll

MarkAllDependenciesAsModified ( CustomNodeDefinition def ) : void

Returns all function instances directly or indirectly depends on the specified function definition and mark them as modified so that their values will be re-queried.

OnAsyncTaskStateChanged ( DynamoScheduler sender, TaskStateChangedEventArgs e ) : void

This event handler is invoked when DynamoScheduler changes the state of an AsyncTask object. See TaskStateChangedEventArgs.State for more details of these state changes.

OnRequestPresetNamePrompt ( Dynamo.Models.PresetsNamePromptEventArgs e ) : void
OnRequestsFunctionNamePrompt ( Object sender, Dynamo.Models.FunctionNamePromptEventArgs e ) : void
OnShutdownCompleted ( ) : void
OnShutdownStarted ( ) : void
OnWorkspaceOpening ( XmlDocument obj ) : void
OnWorkspacePropertyChanged ( object sender, PropertyChangedEventArgs args ) : void
OnWorkspaceSaved ( Dynamo.Models.WorkspaceModel model ) : void
OpenFile ( Dynamo.Models.WorkspaceInfo workspaceInfo, XmlDocument xmlDoc, Dynamo.Models.WorkspaceModel &workspace ) : bool
OpenHomeWorkspace ( XmlDocument xmlDoc, Dynamo.Models.WorkspaceInfo workspaceInfo, Dynamo.Models.WorkspaceModel &workspace ) : bool
PostUIActivation ( object parameter ) : void
PreferenceSettings_PropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Responds to property update notifications on the preferences, and synchronizes with the Units Manager.

RegisterCustomNodeDefinitionWithEngine ( CustomNodeDefinition definition ) : void

Registers (or re-registers) a Custom Node definition with the DesignScript VM, so that instances of the custom node can be evaluated.

RegisterHomeWorkspace ( Dynamo.Models.HomeWorkspaceModel newWorkspace ) : void
RemoveExtension ( IExtension ext ) : void
StartBackupFilesTimer ( ) : void

Start the timer to backup files periodically

UngroupModel ( List modelsToUngroup ) : void
UpdateCustomNodeDefinition ( CustomNodeDefinition definition ) : void

Register custom node defintion and execute all custom node instances.

UpdateManager_Log ( LogEventArgs args ) : void

Method Details

AddCustomNodeWorkspace() public method

Add a new, visible Custom Node workspace to Dynamo
public AddCustomNodeWorkspace ( Dynamo.Models.CustomNodeWorkspaceModel workspace ) : void
workspace Dynamo.Models.CustomNodeWorkspaceModel to add
return void

AddHomeWorkspace() public method

Add a new HomeWorkspace and set as current
public AddHomeWorkspace ( ) : void
return void

AddToSelection() public method

Add an ISelectable object to the selection.
public AddToSelection ( object parameters ) : void
parameters object The object to add to the selection.
return void

AddWorkspace() public method

Adds a workspace to the dynamo model.
public AddWorkspace ( Dynamo.Models.WorkspaceModel workspace ) : void
workspace Dynamo.Models.WorkspaceModel
return void

ClearCurrentWorkspace() public method

Clear the workspace. Removes all nodes, notes, and connectors from the current workspace.
public ClearCurrentWorkspace ( ) : void
return void

Copy() public method

Copy selected ISelectable objects to the clipboard.
public Copy ( ) : void
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

DynamoModel() protected method

Default constructor for DynamoModel
protected DynamoModel ( IStartConfiguration config ) : Dynamo.Configuration
config IStartConfiguration Start configuration
return Dynamo.Configuration

ForceRun() public method

Forces an evaluation of the current workspace by resetting the DesignScript VM.
public ForceRun ( ) : void
return void

OpenCustomNodeWorkspace() public method

Opens an existing custom node workspace.
public OpenCustomNodeWorkspace ( System.Guid guid ) : bool
guid System.Guid Identifier of the workspace to open
return bool

OpenFileFromPath() public method

Opens a Dynamo workspace from a path to an Xml file on disk.
public OpenFileFromPath ( string xmlPath, bool forceManualExecutionMode = false ) : void
xmlPath string Path to file
forceManualExecutionMode bool Set this to true to discard /// execution mode specified in the file and set manual mode
return void

Paste() public method

Paste ISelectable objects from the clipboard to the workspace so that the nodes appear in their original location with a slight offset
public Paste ( ) : void
return void

Paste() public method

Paste ISelectable objects from the clipboard to the workspace at specified point.
public Paste ( Dynamo.Utilities.Point2D targetPoint, bool useOffset = true ) : void
targetPoint Dynamo.Utilities.Point2D Location where data will be pasted
useOffset bool Indicates whether we will use current workspace offset or paste nodes /// directly in this point.
return void

PostShutdownCore() protected method

protected PostShutdownCore ( bool shutdownHost ) : void
shutdownHost bool
return void

PostTraceReconciliation() public method

Deals with orphaned serializables.
public PostTraceReconciliation ( Dictionary orphanedSerializables ) : void
orphanedSerializables Dictionary Collection of orphaned serializables.
return void

PreShutdownCore() protected method

protected PreShutdownCore ( bool shutdownHost ) : void
shutdownHost bool
return void

RemoveWorkspace() public method

Remove a workspace from the dynamo model.
public RemoveWorkspace ( Dynamo.Models.WorkspaceModel workspace ) : void
workspace Dynamo.Models.WorkspaceModel Workspace to remove
return void

ResetEngine() public method

Call this method to reset the virtual machine, avoiding a race condition by using a thread join inside the vm executive.
public ResetEngine ( bool markNodesAsDirty = false ) : void
markNodesAsDirty bool Set this parameter to true to force /// reset of the execution substrait. Note that setting this parameter /// to true will have a negative performance impact.
return void

ResetEngineInternal() protected method

protected ResetEngineInternal ( ) : void
return void

SaveBackupFiles() protected method

Backup all the files
protected SaveBackupFiles ( object state ) : void
state object
return void

ShutDown() public method

External components call this method to shutdown DynamoModel. This method marks 'ShutdownRequested' property to 'true'. This method is used rather than a public virtual method to ensure that the value of ShutdownRequested is set to true.
public ShutDown ( bool shutdownHost ) : void
shutdownHost bool Set this parameter to true to shutdown /// the host application.
return void

ShutDownCore() protected method

protected ShutDownCore ( bool shutdownHost ) : void
shutdownHost bool
return void

Start() public static method

Start DynamoModel with all default configuration options
public static Start ( ) : DynamoModel
return DynamoModel

Start() public static method

Start DynamoModel with custom configuration. Defaults will be assigned not provided.
public static Start ( IStartConfiguration configuration ) : DynamoModel
configuration IStartConfiguration Start configuration
return DynamoModel

Property Details

Context public_oe property

The context that Dynamo is running under.
public string Context
return string

CustomNodeManager public_oe property

Custom Node Manager instance, manages all loaded custom nodes.
public CustomNodeManager,Dynamo.Utilities CustomNodeManager
return Dynamo.Utilities.CustomNodeManager

DebugSettings public_oe property

Debugging settings for this instance of Dynamo.
public DebugSettings DebugSettings
return DebugSettings

LibraryServices public_oe property

Manages all loaded ZeroTouch libraries.
public LibraryServices LibraryServices
return LibraryServices

Loader public_oe property

Manages all loaded NodeModel libraries.
public NodeModelAssemblyLoader Loader
return NodeModelAssemblyLoader

Logger public_oe property

The Dynamo Logger, receives and manages all log messages.
public DynamoLogger Logger
return DynamoLogger

MigrationManager public_oe property

Migration Manager, upgrades old Dynamo file formats to the current version.
public MigrationManager,Dynamo.Models MigrationManager
return Dynamo.Models.MigrationManager

NodeFactory public_oe property

Node Factory, used for creating and intantiating loaded Dynamo nodes.
public NodeFactory NodeFactory
return NodeFactory

PreferenceSettings public_oe property

Preference settings for this instance of Dynamo.
public PreferenceSettings PreferenceSettings
return PreferenceSettings

SearchModel public_oe property

The Dynamo Node Library, complete with Search.
public NodeSearchModel SearchModel
return NodeSearchModel