Skip to main content
Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 25) Class which wraps the ModelCenter COM API. You should be using SModelCenterHost instead of this class as it protects against certain crash cases. Inherits from:
  • AbstractDisposable

Members

Private static attributes

Variable DATE_EPOCH_SECONDS

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 29)
Type: const string

Variable DATE_YEAR_MONTH_DAY

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 30)
Type: const string

Variable DATE_UTCG

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 31)
Type: const string

Private attributes

Variable mcVars

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 33)
Type: readonly Dictionary< string, IVariable >

Variable variables

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 34)
Type: readonly List< PHXVariable >

Variable _dataCollector

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 36)
Type: IDataCollector

Properties

Property ModelCenter

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 45)
Get the ModelCenter COM object. Return type: IModelCenter

Property DataCollector

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 50)
Get the DataCollector COM object. Return type: IDataCollector

Property AddToModel

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 63)
Get the AddToModel COM object. Return type: IAddToModel

Property MyComponent

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 68)
Get my component, if any. DO NOT DISPOSE. Return type: IComponent

Property Log

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 74)
Get the logger. This will always be available, but may not do anything on older MC versions. Return type: IPHXLogger

Property IsAddedToModel

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 203)
Gets a value indicating whether the component has already been added to the model. Return type: bool

Property ModelDirectory

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 239)
Get the directory of the current model. Return type: string

Property RootName

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 283)
Get the name of my component. Return type: string

Property ModelCenterDirectory

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 289)
Get the ModelCenter install directory. Returns: Return type: string

Property NumCurrentVariables

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 482)
Get the number of variables. Return type: int

Property CurrentVariables

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 495)
Get or set a collection of the variables we’ve set/added (but perhaps not committed). On setting, the variables are cloned, and the changes are flushed through to ModelCenter. There are two ways to create variables - set them all at once by setting CurrentVariables, or set them individually with AddVariable then commit with CommitVariableChanges. Do not mix and match Return type: IEnumerable< PHXVariable >

Property ModelCenterWindowHandle

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 735)
Get the handle of the ModelCenter window. Return type: IntPtr

Property ModelCenterWindow

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 754)
Get the ModelCenter window (actually just a handle wrapped in a utility class, but can be used as a window in many cases). Return type: IWin32Window

Events

Event DataCollectorCreated

Definition: LIBS/DotNetUtils/Phoenix.ModelCenter.PlugIn/ModelCenterHost.cs (line 176)
Event generated when a new data collector is created. Type: DataCollectorCreatedEventHandler

Public functions

Function ModelCenterHost

Constructor. Parameters:
  • mc: The ModelCenter COM instance.
  • atm: The AddToModel COM instance.
Parameters:
  • IModelCenter mc
  • IAddToModel atm
Return type:

Function ModelCenterHost

Constructor. Parameters:
  • mc: The ModelCenter COM instance.
  • atm: The AddToModel COM instance.
  • dc: The DataCollector COM instance.
Parameters:
  • IModelCenter mc
  • IAddToModel atm
  • IDataCollector dc
Return type:

Function CreateNewDataCollector

Create a new data collector. Parameters:
  • analysisType: The type of trade study or analysis.
  • configuration: The configuration string.
Returns: The new data collector. Parameters:
  • string analysisType
  • string configuration
Return type: IDataCollector

Function GetAssociatedFiles

Get the list of associated files, if any. Returns: The list of files associated with this plug-in Return type: IEnumerable< string >

Function SetAssociatedFiles

Set the associated files for the component. Parameters:
  • files: The list of files.
Parameters:
  • params string[] files
Return type: void

Function SetAssociatedFiles

Se the associated files for the component. Parameters:
  • files: The sequence of files.
Parameters:
  • ICollection< string > files
Return type: void

Function CheckOutLicenseFeature

Check out the specified license feature. Parameters:
  • featureName: The name of the feature.
Returns: The feature. Parameters:
  • string featureName
Return type: IFeature

Function CheckOutLicenseFeature

Check out the specified license feature. Parameters:
  • featureName: The name of the feature.
  • releaseDate: The release date of the feature in yyyy.MMdd format.
Returns: The feature. Parameters:
  • string featureName
  • string releaseDate
Return type: IFeature

Function RefreshFromModelCenter

Read the variables from ModelCenter and cache locally. Return type: void

Function CommitVariableChanges

Commit any changes in the variable list to ModelCenter. Return type: void

Function AddVariable

Add a new variable to the local list, which will not be committed. There are two ways to create variables - set them all at once by setting CurrentVariables, or set them individually with AddVariable then commit with CommitVariableChanges. Do not mix and match Parameters:
  • v: The variable
Parameters:
  • PHXVariable v
Return type: void

Function GetValue

Get the value of a variable. If the variable was just created individually, you will need to commit changes, because the variable won’t exist yet in the model. Parameters:
  • name: The name of the variable.
Returns: The value of the variable. Parameters:
  • string name
Return type: string

Function GetRawValue

Get the unmodified value of a variable. No formatting is done other than converting to a string. If the variable was just created individually, you will need to commit changes, because the variable won’t exist yet in the model. Parameters:
  • name: The name of the variable.
Returns: The value. Parameters:
  • string name
Return type: string

Function SetValue

Set the value of a variable. If the variable was just created individually, you will need to commit changes, because the variable won’t exist yet in the model. Parameters:
  • v: The variable to set the value for.
  • value: The value to set.
Parameters:
  • PHXVariable v
  • string value
Return type: void

Function SetValue

Set a variable value. If the variable was just created individually, you will need to commit changes, because the variable won’t exist yet in the model. Parameters:
  • name: The name of the variable.
  • value: The value to set.
Parameters:
  • string name
  • string value
Return type: void

Function GetHasChanged

Get whether the value of a variable has changed since the last time we reset the changed flag. If the variable was just created individually, you will need to commit changes, because the variable won’t exist yet in the model. Parameters:
  • name: The name of the variable.
  • reset: Whether the flag should be reset.
Returns: True if yes, false if no. Parameters:
  • string name
  • bool reset = false
Return type: bool

Function ResetHasChanged

Reset the changed flag on a variable. If the variable was just created individually, you will need to commit changes, because the variable won’t exist yet in the model. Parameters:
  • name: The name of the variable.
Parameters:
  • string name
Return type: void

Function BringWindowToTop

Bring a window to the top. Parameters:
  • hWnd: The window handle.
Returns: True on success, false on failure. Parameters:
  • IntPtr hWnd
Return type: bool

Function BringModelCenterToTop

Bring the ModelCenter window to the top and activate it. Return type: void

Function AddIconToModelCenter

Load an icon in ModelCenter. Uses a temporary file. Parameters:
  • icon: The icon to load.
Returns: A unique index to the icon which can be used later. Parameters:
  • Icon icon
Return type: short

Function SetGroupIcon

Set an icon for a group in ModelCenter. Parameters: Parameters:
  • string groupName
  • short iconID
Return type: void

Function CreatePlugInFrame

Create a plugin frame to hold a plugin window. Parameters:
  • name: The name of the plugin.
  • title: The window title.
  • showFavorites: Whether to show favorites.
  • plugin: The plugin object.
  • initialSize: The initial size of the frame.
  • minSize: The minimum size of the frame.
Returns: The window handle of the frame. Parameters:
  • string name
  • string title
  • bool showFavorites
  • IComponentPlugIn plugin
  • Size initialSize
  • Size minSize
Return type: IntPtr

Function ShowPlugInFrame

Use this after creating a frame to ensure that it is shown. Parameters:
  • hwnd: The frame to show.
Parameters:
  • IntPtr hwnd
Return type: void

Function ReleasePlugInFrame

Release the plug-in frame created by CreatePlugInFrame. Parameters:
  • hWnd: The frame window handle.
Parameters:
  • IntPtr hWnd
Return type: void

Private functions

Function init

Return type: void

Function releaseMCVars

Return type: void

Function retrieveVariablesRecursive

Retrieve variables from nested groups, recursively. Parameters:
  • prefix: The name prefix (previously-seen groups).
  • mcObject: The component or group to search.
Parameters:
  • string prefix
  • object mcObject
Return type: void

Function getVariableInternal

Parameters:
  • string name
Return type: IVariable

Function setValueInternal

Parameters:
  • IVariable var
  • PHXDataType type
  • string value
Return type: void

Function find

Retrieve a variable or group, recursively. Parameters:
  • mcObject: The component or group to search.
  • name: The relative name to search for.
Parameters:
  • object mcObject
  • string name
Return type: object

Function createPlugInFrame2

Parameters:
  • string name
  • string title
  • object plugin
  • bool showFavorites
  • Size initialSize
  • Size minSize
Return type: IntPtr

Function createPlugInFrame

Parameters:
  • string name
  • string title
  • object plugin
  • bool showFavorites
  • Size initialSize
Return type: IntPtr

Protected functions

Function Dispose

Dispose of the COM objects immediately to avoid having to wait for garbage collection. Parameters:
  • disposing: Whether we are in the disposing phase
Parameters:
  • bool disposing
Return type: override void

Private static functions

Function getGroups

Parameters:
  • object obj
Return type: IGroups

Function getVariables

Parameters:
  • object obj
Return type: IVariables