Class ScriptModule
LisRT Module for a Python script project.
Implements
Inherited Members
Namespace: Loehnert.Lisrt.Scripting
Assembly: Loehnert.Lisrt.Scripting.dll
Syntax
public class ScriptModule : LisrtModule, INotifyPropertyChangedEx, ILisrtModule, INotifyPropertyChanged, IHasServiceView, IHandle<CancelApplicationExitEvent>, IHandle
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.
Declaration
public ScriptModule(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name for this script module. |
ScriptModule(String, ILockService, IEventAggregator, IProjectTemplateService, IShell, IUserManager)
Initializes a new instance of the ScriptModule class.
Declaration
public ScriptModule(string name, ILockService lockService, IEventAggregator eventAggregator, IProjectTemplateService projectTemplateService, IShell shell, IUserManager userManager)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name for this module. |
ILockService | lockService | Lock service which locks script project items. |
Caliburn.Micro.IEventAggregator | eventAggregator | Event aggregator. |
IProjectTemplateService | projectTemplateService | Project template service. |
IShell | shell | Main shell. |
IUserManager | userManager | Manager for the users. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when a argument is null. |
Properties
CanExitWhenScriptIsRunning
Gets or sets a value indicating whether the application can be exited when the script is running.
Declaration
public bool CanExitWhenScriptIsRunning { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Enabled
Gets or sets a value indicating whether the LisrtModule instance is enabled. This property returns always true.
Declaration
public override bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when set to false. |
Icon
Gets the icon for the IModuleTree.
Declaration
public override Uri Icon { get; }
Property Value
Type | Description |
---|---|
Uri |
Overrides
Parent
Gets or sets the parent LisrtModule instance.
Declaration
public override ILisrtModule Parent { get; set; }
Property Value
Type | Description |
---|---|
ILisrtModule |
Overrides
Project
Gets or sets the current script project. Setting can be canceled in the ProjectChanging event.
Declaration
public IProject Project { get; set; }
Property Value
Type | Description |
---|---|
IProject |
ScriptEngine
Gets the script engine.
Declaration
public virtual Engine ScriptEngine { get; }
Property Value
Type | Description |
---|---|
Engine |
TreeItem
Gets the view model for the module.
Declaration
public override ITreeItem TreeItem { get; }
Property Value
Type | Description |
---|---|
ITreeItem |
Overrides
Methods
ExecuteProject()
Executes the startup file of the current project.
Declaration
public void ExecuteProject()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when no project is loaded or the loaded project doesn't have a startup item. |
See Also
Handle(CancelApplicationExitEvent)
Handles the CancelApplicationExitEvent message. Prevents the application from exiting when the script runs.
Declaration
public void Handle(CancelApplicationExitEvent message)
Parameters
Type | Name | Description |
---|---|---|
CancelApplicationExitEvent | message | Closing event message. |
LoadProject(String)
Loads a project from the path to the module using the LoadProject(String) method.
Declaration
public void LoadProject(string filePath)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | Path 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
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when no template with the file extension exists. |
ShowServiceView()
Shows the service window.
Declaration
public virtual void ShowServiceView()
UnloadProject()
Unloads the current project.
Declaration
public void UnloadProject()
Exceptions
Type | Condition |
---|---|
System.OperationCanceledException | Thrown when ProjectChanging was canceled. |
Events
ProjectChanged
Occurs on any project change and on change of the project itself.
Declaration
public event EventHandler ProjectChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
ProjectChanging
Declaration
public event EventHandler<CancelEventArgs> ProjectChanging
Event Type
Type | Description |
---|---|
System.EventHandler<System.ComponentModel.CancelEventArgs> |