Class ChainNodeViewModel

One row of the BodyRig card's kinematic-chain strip: a segment shown at its depth in the tree, with the sensor bound to it and whether that sensor is currently delivering packets.

Inheritance
ChainNodeViewModel
Namespace: MOSAIC.ViewModels.Devices
Assembly: MOSAIC.dll
Syntax
public class ChainNodeViewModel : ObservableObject, INotifyPropertyChanged, INotifyPropertyChanging
Remarks

Deliberately holds no brushes. Colours come from converters and style classes in the view, so they follow a theme switch; an IBrush captured here would go stale.

Constructors

ChainNodeViewModel(int, int, string)

Initialises a row for index at depth.

Declaration
public ChainNodeViewModel(int index, int depth, string glyph)
Parameters
Type Name Description
int index
int depth
string glyph

Fields

IndentPerLevel

Indent per depth level, in device-independent pixels.

Declaration
private const double IndentPerLevel = 12
Field Value
Type Description
double

MaxIndent

Indent ceiling. The card is ~440px wide and the row already spends ~140px on the glyph, index pill, sensor chip and liveness dot; letting a deep chain indent without bound would squeeze the segment name to nothing.

Declaration
private const double MaxIndent = 48
Field Value
Type Description
double

_displayName

Segment name, falling back to its index when unnamed.

Declaration
[ObservableProperty]
private string _displayName
Field Value
Type Description
string

_isLive

Whether the bound sensor delivered a packet recently. False for a passive segment and for a bound sensor that has gone quiet.

Declaration
[ObservableProperty]
private bool _isLive
Field Value
Type Description
bool

_isSelected

Whether this row is the one the editors below the strip are bound to.

Declaration
[ObservableProperty]
private bool _isSelected
Field Value
Type Description
bool

_sensorLabel

Short sensor tag, e.g. S3, or an em dash when the segment is passive.

Declaration
[ObservableProperty]
private string _sensorLabel
Field Value
Type Description
string

_sensorTooltip

Hover text explaining the sensor binding and its packet activity.

Declaration
[ObservableProperty]
private string _sensorTooltip
Field Value
Type Description
string

Properties

Depth

Depth in the tree; 0 for a root or an unparented segment.

Declaration
public int Depth { get; }
Property Value
Type Description
int

DisplayName

Segment name, falling back to its index when unnamed.

Declaration
[ExcludeFromCodeCoverage]
public string DisplayName { get; set; }
Property Value
Type Description
string

Glyph

Leading glyph: a filled dot for a root, an elbow for a child, a warning sign for a segment that could not be reached from any root (a cycle, or a dangling parent).

Declaration
public string Glyph { get; }
Property Value
Type Description
string

IndentWidth

Left indent for this row, derived from Depth and capped.

Declaration
public double IndentWidth { get; }
Property Value
Type Description
double

Index

Index of this segment in the block's chain array.

Declaration
public int Index { get; }
Property Value
Type Description
int

IsLive

Whether the bound sensor delivered a packet recently. False for a passive segment and for a bound sensor that has gone quiet.

Declaration
[ExcludeFromCodeCoverage]
public bool IsLive { get; set; }
Property Value
Type Description
bool

IsSelected

Whether this row is the one the editors below the strip are bound to.

Declaration
[ExcludeFromCodeCoverage]
public bool IsSelected { get; set; }
Property Value
Type Description
bool

SensorLabel

Short sensor tag, e.g. S3, or an em dash when the segment is passive.

Declaration
[ExcludeFromCodeCoverage]
public string SensorLabel { get; set; }
Property Value
Type Description
string

SensorTooltip

Hover text explaining the sensor binding and its packet activity.

Declaration
[ExcludeFromCodeCoverage]
public string SensorTooltip { get; set; }
Property Value
Type Description
string

Methods

OnDisplayNameChanged(string)

Executes the logic for when DisplayName just changed.

Declaration
private void OnDisplayNameChanged(string value)
Parameters
Type Name Description
string value

The new property value that was set.

Remarks

This method is invoked right after the value of DisplayName is changed.

OnDisplayNameChanged(string?, string)

Executes the logic for when DisplayName just changed.

Declaration
private void OnDisplayNameChanged(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that was replaced.

string newValue

The new property value that was set.

Remarks

This method is invoked right after the value of DisplayName is changed.

OnDisplayNameChanging(string)

Executes the logic for when DisplayName is changing.

Declaration
private void OnDisplayNameChanging(string value)
Parameters
Type Name Description
string value

The new property value being set.

Remarks

This method is invoked right before the value of DisplayName is changed.

OnDisplayNameChanging(string?, string)

Executes the logic for when DisplayName is changing.

Declaration
private void OnDisplayNameChanging(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that is being replaced.

string newValue

The new property value being set.

Remarks

This method is invoked right before the value of DisplayName is changed.

OnIsLiveChanged(bool)

Executes the logic for when IsLive just changed.

Declaration
private void OnIsLiveChanged(bool value)
Parameters
Type Name Description
bool value

The new property value that was set.

Remarks

This method is invoked right after the value of IsLive is changed.

OnIsLiveChanged(bool, bool)

Executes the logic for when IsLive just changed.

Declaration
private void OnIsLiveChanged(bool oldValue, bool newValue)
Parameters
Type Name Description
bool oldValue

The previous property value that was replaced.

bool newValue

The new property value that was set.

Remarks

This method is invoked right after the value of IsLive is changed.

OnIsLiveChanging(bool)

Executes the logic for when IsLive is changing.

Declaration
private void OnIsLiveChanging(bool value)
Parameters
Type Name Description
bool value

The new property value being set.

Remarks

This method is invoked right before the value of IsLive is changed.

OnIsLiveChanging(bool, bool)

Executes the logic for when IsLive is changing.

Declaration
private void OnIsLiveChanging(bool oldValue, bool newValue)
Parameters
Type Name Description
bool oldValue

The previous property value that is being replaced.

bool newValue

The new property value being set.

Remarks

This method is invoked right before the value of IsLive is changed.

OnIsSelectedChanged(bool)

Executes the logic for when IsSelected just changed.

Declaration
private void OnIsSelectedChanged(bool value)
Parameters
Type Name Description
bool value

The new property value that was set.

Remarks

This method is invoked right after the value of IsSelected is changed.

OnIsSelectedChanged(bool, bool)

Executes the logic for when IsSelected just changed.

Declaration
private void OnIsSelectedChanged(bool oldValue, bool newValue)
Parameters
Type Name Description
bool oldValue

The previous property value that was replaced.

bool newValue

The new property value that was set.

Remarks

This method is invoked right after the value of IsSelected is changed.

OnIsSelectedChanging(bool)

Executes the logic for when IsSelected is changing.

Declaration
private void OnIsSelectedChanging(bool value)
Parameters
Type Name Description
bool value

The new property value being set.

Remarks

This method is invoked right before the value of IsSelected is changed.

OnIsSelectedChanging(bool, bool)

Executes the logic for when IsSelected is changing.

Declaration
private void OnIsSelectedChanging(bool oldValue, bool newValue)
Parameters
Type Name Description
bool oldValue

The previous property value that is being replaced.

bool newValue

The new property value being set.

Remarks

This method is invoked right before the value of IsSelected is changed.

OnSensorLabelChanged(string)

Executes the logic for when SensorLabel just changed.

Declaration
private void OnSensorLabelChanged(string value)
Parameters
Type Name Description
string value

The new property value that was set.

Remarks

This method is invoked right after the value of SensorLabel is changed.

OnSensorLabelChanged(string?, string)

Executes the logic for when SensorLabel just changed.

Declaration
private void OnSensorLabelChanged(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that was replaced.

string newValue

The new property value that was set.

Remarks

This method is invoked right after the value of SensorLabel is changed.

OnSensorLabelChanging(string)

Executes the logic for when SensorLabel is changing.

Declaration
private void OnSensorLabelChanging(string value)
Parameters
Type Name Description
string value

The new property value being set.

Remarks

This method is invoked right before the value of SensorLabel is changed.

OnSensorLabelChanging(string?, string)

Executes the logic for when SensorLabel is changing.

Declaration
private void OnSensorLabelChanging(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that is being replaced.

string newValue

The new property value being set.

Remarks

This method is invoked right before the value of SensorLabel is changed.

OnSensorTooltipChanged(string)

Executes the logic for when SensorTooltip just changed.

Declaration
private void OnSensorTooltipChanged(string value)
Parameters
Type Name Description
string value

The new property value that was set.

Remarks

This method is invoked right after the value of SensorTooltip is changed.

OnSensorTooltipChanged(string?, string)

Executes the logic for when SensorTooltip just changed.

Declaration
private void OnSensorTooltipChanged(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that was replaced.

string newValue

The new property value that was set.

Remarks

This method is invoked right after the value of SensorTooltip is changed.

OnSensorTooltipChanging(string)

Executes the logic for when SensorTooltip is changing.

Declaration
private void OnSensorTooltipChanging(string value)
Parameters
Type Name Description
string value

The new property value being set.

Remarks

This method is invoked right before the value of SensorTooltip is changed.

OnSensorTooltipChanging(string?, string)

Executes the logic for when SensorTooltip is changing.

Declaration
private void OnSensorTooltipChanging(string? oldValue, string newValue)
Parameters
Type Name Description
string oldValue

The previous property value that is being replaced.

string newValue

The new property value being set.

Remarks

This method is invoked right before the value of SensorTooltip is changed.

Implements

INotifyPropertyChanged
INotifyPropertyChanging

Search documentation

Start typing to search the documentation.