Table of Contents

Class OperatingModeManager

Namespace
Loehnert.Lisrt.OperatingMode
Assembly
Loehnert.Lisrt.dll

Manager for operating modes.

[Export(typeof(IOperatingModeManager))]
public class OperatingModeManager : PropertyChangedBase, INotifyPropertyChangedEx, INotifyPropertyChanged, IOperatingModeManager
Inheritance
PropertyChangedBase
OperatingModeManager
Implements
INotifyPropertyChangedEx
Inherited Members
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.PropertyChanged
Extension Methods

Constructors

OperatingModeManager(IEnumerable<IOperatingMode>)

Initializes a new instance of the OperatingModeManager class.

public OperatingModeManager(IEnumerable<IOperatingMode> modes)

Parameters

modes IEnumerable<IOperatingMode>

All operating modes.

Remarks

Required for compatibility.

Exceptions

ArgumentNullException

Thrown when modes is null.

OperatingModeManager(IEnumerable<Lazy<IOperatingMode>>)

Initializes a new instance of the OperatingModeManager class.

public OperatingModeManager(IEnumerable<Lazy<IOperatingMode>> lazyModes)

Parameters

lazyModes IEnumerable<Lazy<IOperatingMode>>

All operating modes as Lazy<T>.

Exceptions

ArgumentNullException

Thrown when lazyModes is null.

Properties

CurrentMode

Gets the current operating mode.

public IOperatingMode CurrentMode { get; }

Property Value

IOperatingMode

ModeIsChanging

Gets a value indicating whether the current mode is changing.

public bool ModeIsChanging { get; }

Property Value

bool

Modes

Gets all operating modes.

public KeyItemCollection<IOperatingMode> Modes { get; }

Property Value

KeyItemCollection<IOperatingMode>

Methods

TrySetMode(IOperatingMode)

Sets a new operating mode by object with key.

public bool TrySetMode(IOperatingMode newMode)

Parameters

newMode IOperatingMode

The new mode.

Returns

bool

true if the mode is set, otherwise false.

Exceptions

ArgumentNullException

Thrown when newMode is null.

KeyNotFoundException

Thrown when newMode.Key.Key doesn't exists in the Modes.

InvalidOperationException

Thrown when newMode.Key.Key cannot be enabled.

OperationCanceledException

Thrown when the OperatingModeChanging is canceled.

TrySetMode(string)

Sets a new operating mode by object with key.

public bool TrySetMode(string modeKey)

Parameters

modeKey string

The new mode key.

Returns

bool

true if the mode has set successfully, otherwise false.

Exceptions

ArgumentNullException

Thrown when modeKey is null, empty or white space.

KeyNotFoundException

Thrown when modeKey doesn't exists in the Modes.

InvalidOperationException

Thrown when modeKey cannot be enabled.

InvalidOperationException

Thrown when the OperatingModeChanging is canceled.

Events

OperatingModeChanged

Occurs when the current operating mode has changed.

public event EventHandler<OperatingModeChangedEventArgs> OperatingModeChanged

Event Type

EventHandler<OperatingModeChangedEventArgs>

OperatingModeChanging

Occurs before the operating mode changes.

public event EventHandler<OperatingModeChangingEventArgs> OperatingModeChanging

Event Type

EventHandler<OperatingModeChangingEventArgs>