Table of Contents

Class ServiceViewModelBase

Namespace
Loehnert.Lisrt.Modules.ViewModels
Assembly
Loehnert.Lisrt.Modules.dll

Represents a base class for a service view with a IsEnabled property for the view.

public abstract class ServiceViewModelBase : Document, IViewAware, IChild, IDocument, ILayoutItem, IScreen, IHaveDisplayName, IActivate, IDeactivate, IGuardClose, IClose, INotifyPropertyChangedEx, INotifyPropertyChanged, ICommandHandler<UndoCommandDefinition>, ICommandHandler<RedoCommandDefinition>, ICommandHandler<SaveFileCommandDefinition>, ICommandHandler<SaveFileAsCommandDefinition>, ICommandHandler
Inheritance
PropertyChangedBase
ViewAware
Screen
ServiceViewModelBase
Implements
IViewAware
IChild
IScreen
IHaveDisplayName
IActivate
IDeactivate
IGuardClose
IClose
INotifyPropertyChangedEx
Derived
Inherited Members
Screen.OnInitialize()
Screen.OnActivate()
Screen.Parent
Screen.DisplayName
Screen.IsActive
Screen.IsInitialized
Screen.Activated
Screen.AttemptingDeactivation
Screen.Deactivated
ViewAware.DefaultContext
ViewAware.Views
ViewAware.ViewAttached
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.PropertyChanged
Extension Methods

Remarks

The IsEnabled property calls the GetEnabled method. The default GetEnabled method enables the service view when:

You can change this behavior globally by setting a user-defined function to the GetEnabled property.

Constructors

ServiceViewModelBase(ILisrtModule)

Initializes a new instance of the ServiceViewModelBase class. Calls the ServiceViewModelBase(ILisrtModule, IUserManager, IOperatingModeManager) constructor, to get the IUserManager and the IOperatingModeManager implementations by the Caliburn.Micro.IoC.

protected ServiceViewModelBase(ILisrtModule module)

Parameters

module ILisrtModule

The module for the service view.

Exceptions

ArgumentNullException

Thrown when module is null.

ServiceViewModelBase(ILisrtModule, IUserManager, IOperatingModeManager)

Initializes a new instance of the ServiceViewModelBase class.

protected ServiceViewModelBase(ILisrtModule module, IUserManager userManager, IOperatingModeManager operatingModeManager)

Parameters

module ILisrtModule

The module for the service view.

userManager IUserManager

Manager for the users.

operatingModeManager IOperatingModeManager

Manager for the operating modes.

Exceptions

ArgumentNullException

Thrown when module, userManager or operatingModeManager is null.

Fields

_module

Gets the depending LisRT module.

protected readonly ILisrtModule _module

Field Value

ILisrtModule

Properties

GetEnabled

Gets or sets a method for getting the IsEnabled value.

public static Predicate<ILisrtModule> GetEnabled { get; set; }

Property Value

Predicate<ILisrtModule>

Remarks

Note that the value is set when you construct the ServiceViewModelBase the first time. When you set another predicate, don't forget to rise the PropertyChanged for IsEnabled if any depending value changes.

Exceptions

ArgumentException

Thrown when set to null.

IconSource

Gets the icon.

public override Uri IconSource { get; }

Property Value

Uri

IsEnabled

Gets a value indicating whether the controls in the view can be changed.

public virtual bool IsEnabled { get; }

Property Value

bool

Title

Gets the title.

public virtual string Title { get; }

Property Value

string

Examples

The _module is type of "LaserModule" and implements IHasDeviceLabel. The DeviceLabel is 10K3.
Then the Title property returns: Laser (10K3).

Remarks

Returns the module type name and the device label.

See Also

Methods

ForceUpdatedIsEnabled()

Forces an update for IsEnabled in all ServiceViewModelBases.

public static void ForceUpdatedIsEnabled()

Remarks

Rising a NotifyOfPropertyChange(string) for IsEnabled should be preferred.

GetDeviceLabelForTitle()

Gets the device label for extension for the Title.

protected string GetDeviceLabelForTitle()

Returns

string

If _module has a device label, the device label in brackets otherwise an empty string.