Table of Contents

Class PythonFileViewModel

Namespace
Loehnert.Lisrt.Scripting.Editor.File.Python.ViewModels
Assembly
Loehnert.Lisrt.Scripting.dll

View model for a python file.

public class PythonFileViewModel : TextFileViewModel, IViewAware, IChild, ICommandHandler<UndoCommandDefinition>, ICommandHandler<RedoCommandDefinition>, ICommandHandler<SaveFileCommandDefinition>, ICommandHandler<SaveFileAsCommandDefinition>, ICommandHandler, IProjectItemDocument, IPersistedDocument, IDocument, ILayoutItem, IScreen, IHaveDisplayName, IActivate, IDeactivate, IGuardClose, IClose, INotifyPropertyChangedEx, INotifyPropertyChanged, IPersistedElement, IHandle<TextEditorSettingsChangedEvent>, IHandle<CalledLineChangedEvent>, IHandle, ICanCommentOut
Inheritance
PropertyChangedBase
ViewAware
Screen
PythonFileViewModel
Implements
IViewAware
IChild
IScreen
IHaveDisplayName
IActivate
IDeactivate
IGuardClose
IClose
INotifyPropertyChangedEx
IHandle
Inherited Members
Screen.OnActivate()
Screen.Parent
Screen.IsActive
Screen.IsInitialized
Screen.Activated
Screen.AttemptingDeactivation
Screen.Deactivated
ViewAware.DefaultContext
ViewAware.Views
ViewAware.ViewAttached
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.PropertyChanged

Constructors

PythonFileViewModel(IProjectItem, IScriptShell, IEventAggregator, IIntelliSenseService)

Initializes a new instance of the PythonFileViewModel class.

public PythonFileViewModel(IProjectItem projectItem, IScriptShell parentShell, IEventAggregator eventAggregator, IIntelliSenseService intelliSenseService)

Parameters

projectItem IProjectItem

Python project item.

parentShell IScriptShell

Shell for the view model.

eventAggregator IEventAggregator

Event aggregator for Caliburn.Micro.IHandle<TMessage>.

intelliSenseService IIntelliSenseService

IntelliSense service, null for no IntelliSense.

Exceptions

ArgumentNullException

Thrown when projectItem, eventAggregator or parentShell is null.

ArgumentException

Thrown when projectItem is not of type TextProjectItem.

PythonFileViewModel(IProjectItem, IScriptShell, IEventAggregator, IIntelliSenseService, ILockService, IUserManager, IMenuBuilder, IWindowManager)

Initializes a new instance of the PythonFileViewModel class.

public PythonFileViewModel(IProjectItem projectItem, IScriptShell parentShell, IEventAggregator eventAggregator, IIntelliSenseService intelliSenseService, ILockService lockService, IUserManager userManager, IMenuBuilder menuBuilder, IWindowManager windowManager)

Parameters

projectItem IProjectItem

Text based project item (TextProjectItem).

parentShell IScriptShell

Shell for the view model.

eventAggregator IEventAggregator

Event aggregator for Caliburn.Micro.IHandle<TMessage>.

intelliSenseService IIntelliSenseService

IntelliSense service, null for no IntelliSense.

lockService ILockService

A service providing locks.

userManager IUserManager

Manager for users.

menuBuilder IMenuBuilder

Menu builder to build the context menu.

windowManager IWindowManager

Window manager to show dialogs.

Exceptions

ArgumentNullException

Thrown when projectItem, eventAggregator, parentShell, lockService or userManager is null.

ArgumentException

Thrown when projectItem is not of type TextProjectItem.

Properties

BreakPoints

Gets the break points.

public BreakPointCollection BreakPoints { get; }

Property Value

BreakPointCollection

CalledLine

Gets the line which was called by the call stack.

public int CalledLine { get; }

Property Value

int

Remarks

Value zero means not labeled. The called line is only visible in break mode and is usually labeled when a call-stack-call is clicked.

DefaultSettings

Gets the default settings.

protected override CodeEditorSettings DefaultSettings { get; }

Property Value

CodeEditorSettings

DisplayName

Gets or sets the display name.

public override string DisplayName { get; set; }

Property Value

string

ExecutingLine

Gets the executing line.

public int ExecutingLine { get; }

Property Value

int

Remarks

Value zero means not executed.

KnownVariables

Gets the known variables for auto complete.

public IEnumerable<KeyValuePair<string, object>> KnownVariables { get; }

Property Value

IEnumerable<KeyValuePair<string, object>>

Methods

CommentOutSelectedLines()

Comments the selected lines out.

public void CommentOutSelectedLines()

Handle(CalledLineChangedEvent)

Handle the CalledLineChangedEvent message.

public void Handle(CalledLineChangedEvent message)

Parameters

message CalledLineChangedEvent

Message about the change of a called line which should be labeled.

Handle(TextEditorSettingsChangedEvent)

Handles the message for changed editor settings.

public override void Handle(TextEditorSettingsChangedEvent message)

Parameters

message TextEditorSettingsChangedEvent

The message.

OnDeactivate(bool)

Called when deactivating.

protected override void OnDeactivate(bool close)

Parameters

close bool

True, if the view is closed.

OnViewLoaded(object)

Called when an attached view's Loaded event fires.

protected override void OnViewLoaded(object view)

Parameters

view object

Loaded view.

Remarks

Registers with MahApps.Metro.Controls.Dialogs.DialogParticipation for the MetroDialogs and loads the text from file with DoLoad(string).

UnCommentSelectedLines()

Uncomments the selected lines.

public void UnCommentSelectedLines()