Table of Contents

Class ScriptModule

Namespace
Loehnert.Lisrt.Scripting
Assembly
Loehnert.Lisrt.Scripting.dll

LisRT Module for a Python script project.

public class ScriptModule : LisrtModule, INotifyPropertyChangedEx, ILisrtModule, INotifyPropertyChanged, IHasServiceView, IHandle<CancelApplicationExitEvent>, IHandle
Inheritance
PropertyChangedBase
ScriptModule
Implements
INotifyPropertyChangedEx
IHandle
Inherited Members
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.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

name string

Name 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

name string

Name for this module.

lockService ILockService

Lock service which locks script project items.

eventAggregator IEventAggregator

Event aggregator.

projectTemplateService IProjectTemplateService

Project template service.

shell IShell

Main shell.

userManager IUserManager

Manager for the users.

Exceptions

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.

public bool CanExitWhenScriptIsRunning { get; set; }

Property Value

bool

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

bool

Exceptions

InvalidOperationException

Thrown when set to false.

Icon

Gets the icon for the IModuleTree.

public override Uri Icon { get; }

Property Value

Uri

Parent

Gets or sets the parent LisrtModule instance.

public override ILisrtModule Parent { get; set; }

Property Value

ILisrtModule

Project

Gets or sets the current script project. Setting can be canceled in the ProjectChanging event.

public IProject Project { get; set; }

Property Value

IProject

ScriptEngine

Gets the script engine.

public virtual Engine ScriptEngine { get; }

Property Value

Engine

TreeItem

Gets the view model for the module.

public override ITreeItem TreeItem { get; }

Property Value

ITreeItem

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.

See Also

Handle(CancelApplicationExitEvent)

Handles the CancelApplicationExitEvent message. Prevents the application from exiting when the script runs.

public void Handle(CancelApplicationExitEvent message)

Parameters

message CancelApplicationExitEvent

Closing event message.

LoadProject(string)

Loads a project from the path to the module using the LoadProject(string) method.

public void LoadProject(string filePath)

Parameters

filePath string

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

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

EventHandler

ProjectChanging

Occurs before Project property changes. A project change can be canceled by the Cancel property.

public event EventHandler<CancelEventArgs> ProjectChanging

Event Type

EventHandler<CancelEventArgs>

See Also