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
-
PropertyChangedBaseViewAwareScreenServiceViewModelBase
- Implements
-
IViewAwareIChildIScreenIHaveDisplayNameIActivateIDeactivateIGuardCloseICloseINotifyPropertyChangedEx
- Derived
- Inherited Members
-
Screen.OnInitialize()Screen.OnActivate()Screen.ParentScreen.DisplayNameScreen.IsActiveScreen.IsInitializedScreen.ActivatedScreen.AttemptingDeactivationScreen.DeactivatedViewAware.DefaultContextViewAware.ViewsViewAware.ViewAttachedPropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
- Extension Methods
Remarks
The IsEnabled property calls the GetEnabled method. The default GetEnabled method enables the service view when:
- The modules Enabled property is true
- The current user has the UseServiceWindow permission.
- The InitializationState is Initialized (only when the module implements IInitializable)
- The current operationg mode is a manual mode (only when a manual mode exists)
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
ILisrtModuleThe 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
ILisrtModuleThe module for the service view.
userManager
IUserManagerManager for the users.
operatingModeManager
IOperatingModeManagerManager for the operating modes.
Exceptions
- ArgumentNullException
Thrown when
module
,userManager
oroperatingModeManager
is null.
Fields
_module
Gets the depending LisRT module.
protected readonly ILisrtModule _module
Field Value
Properties
GetEnabled
Gets or sets a method for getting the IsEnabled value.
public static Predicate<ILisrtModule> GetEnabled { get; set; }
Property Value
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
IsEnabled
Gets a value indicating whether the controls in the view can be changed.
public virtual bool IsEnabled { get; }
Property Value
Title
Gets the title.
public virtual string Title { get; }
Property Value
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()