Class ScriptModule
LisRT Module for a Python script project.
public class ScriptModule : LisrtModule, INotifyPropertyChangedEx, ILisrtModule, INotifyPropertyChanged, IHasServiceView, IHandle<CancelApplicationExitEvent>, IHandle
  - Inheritance
 - 
      
      PropertyChangedBaseScriptModule
 
- Implements
 - 
      INotifyPropertyChangedExIHandle<CancelApplicationExitEvent>IHandle
 
- Inherited Members
 - 
    
    
    PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
 
Constructors
ScriptModule(string)
Initializes a new instance of the ScriptModule class. Calls ScriptModule(string, ILockService, IEventAggregator, IProjectTemplateService, IShell, IUserManager), arguments are filled by Caliburn.Micro.IoC.
public ScriptModule(string name)
  Parameters
namestringName for this script module.
ScriptModule(string, ILockService, IEventAggregator, IProjectTemplateService, IShell, IUserManager)
Initializes a new instance of the ScriptModule class.
public ScriptModule(string name, ILockService lockService, IEventAggregator eventAggregator, IProjectTemplateService projectTemplateService, IShell shell, IUserManager userManager)
  Parameters
namestringName for this module.
lockServiceILockServiceLock service which locks script project items.
eventAggregatorIEventAggregatorEvent aggregator.
projectTemplateServiceIProjectTemplateServiceProject template service.
shellIShellMain shell.
userManagerIUserManagerManager for the users.
Exceptions
- ArgumentNullException
 Thrown when a argument is null.
ScriptModule(string, ILockService, IEventAggregator, IProjectTemplateService, IShell, IUserManager, IDictionary<string, object>)
Initializes a new instance of the ScriptModule class.
public ScriptModule(string name, ILockService lockService, IEventAggregator eventAggregator, IProjectTemplateService projectTemplateService, IShell shell, IUserManager userManager, IDictionary<string, object> options)
  Parameters
namestringName for this module.
lockServiceILockServiceLock service which locks script project items.
eventAggregatorIEventAggregatorEvent aggregator.
projectTemplateServiceIProjectTemplateServiceProject template service.
shellIShellMain shell.
userManagerIUserManagerManager for the users.
optionsIDictionary<string, object>Python options, see PythonOptions.
Exceptions
- ArgumentNullException
 Thrown when a argument is null.
ScriptModule(string, IDictionary<string, object>)
Initializes a new instance of the ScriptModule class. Calls ScriptModule(string, ILockService, IEventAggregator, IProjectTemplateService, IShell, IUserManager), arguments are filled by Caliburn.Micro.IoC.
public ScriptModule(string name, IDictionary<string, object> options)
  Parameters
namestringName for this script module.
optionsIDictionary<string, object>Python options, see PythonOptions.
Properties
CanExitWhenScriptIsRunning
Gets or sets a value indicating whether the application can be exited when the script is running.
public bool CanExitWhenScriptIsRunning { get; set; }
  Property Value
Enabled
Gets or sets a value indicating whether the LisrtModule instance is enabled. This property returns always true.
public override bool Enabled { get; set; }
  Property Value
Exceptions
- InvalidOperationException
 Thrown when set to false.
Icon
Gets the icon for the IModuleTree.
public override Uri Icon { get; }
  Property Value
Parent
Gets or sets the parent LisrtModule instance.
public override ILisrtModule Parent { get; set; }
  Property Value
Project
Gets or sets the current script project. Setting can be canceled in the ProjectChanging event.
public IProject Project { get; set; }
  Property Value
ScriptEngine
Gets the script engine.
public virtual Engine ScriptEngine { get; }
  Property Value
TreeItem
Gets the view model for the module.
public override ITreeItem TreeItem { get; }
  Property Value
Methods
ExecuteProject()
Executes the startup file of the current project.
public void ExecuteProject()
  Exceptions
- InvalidOperationException
 Thrown when no project is loaded
-or- the loaded project doesn't have a startup item
-or- The script is already running.- ScriptCanceledException
 Thrown when the script is canceled.
- See Also
 
Handle(CancelApplicationExitEvent)
Handles the CancelApplicationExitEvent message. Prevents the application from exiting when the script runs.
public void Handle(CancelApplicationExitEvent message)
  Parameters
messageCancelApplicationExitEventClosing event message.
LoadProject(string)
Loads a project from the path to the module using the LoadProject(string) method.
public void LoadProject(string filePath)
  Parameters
filePathstringPath to the project file.
Remarks
Make sure that an IProjectTemplate with the project file extension was exported. Consider using UnloadProject() before setting a new project.
Exceptions
- InvalidOperationException
 Thrown when no template with the file extension exists.
ShowServiceView()
Shows the service window.
public virtual void ShowServiceView()
  UnloadProject()
Unloads the current project.
public void UnloadProject()
  Exceptions
- OperationCanceledException
 Thrown when ProjectChanging was canceled.
Events
ProjectChanged
Occurs on any project change and on change of the project itself.
public event EventHandler ProjectChanged
  Event Type
ProjectChanging
public event EventHandler<CancelEventArgs> ProjectChanging