Files
2026-04-17 14:55:32 -04:00

20 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Converters/BooleanToBorderThicknessConverter.cs
Common/DTS.Common/Converters/BooleanToBorderBrushConverter.cs
Common/DTS.Common/Converters/BooleanToGreenBorderConverter.cs
Common/DTS.Common/Converters/YesNoRadioButtonsConventer.cs
Common/DTS.Common/Converters/BooleanOrMultiConverter.cs
Common/DTS.Common/Converters/DateTimeWithMillisecondsToStringConverter.cs
Common/DTS.Common/Converters/EnumVisibilityConverter.cs
Common/DTS.Common/Converters/InverseEnumVisibilityConverter.cs
Common/DTS.Common/Converters/ActiveContentConverter.cs
Common/DTS.Common/Converters/FaultedTextConverter.cs
Common/DTS.Common/Converters/TriggerTextConverter.cs
Common/DTS.Common/Converters/TriggerColorConverter.cs
Common/DTS.Common/Converters/FaultedColorConverter.cs
Common/DTS.Common/Converters/DateConverter.cs
Common/DTS.Common/Converters/NullableFloatConverter.cs
Common/DTS.Common/Converters/InverseEnumEnabledConverter.cs
Common/DTS.Common/Converters/IsLessThanConverter.cs
Common/DTS.Common/Converters/ListToStringConverter.cs
Common/DTS.Common/Converters/IsGreaterThanConverter.cs
Common/DTS.Common/Converters/NonZeroToColorConverter.cs
Common/DTS.Common/Converters/HeightConverter.cs
Common/DTS.Common/Converters/ErrorToBooleanConverter.cs
Common/DTS.Common/Converters/WidthConverter.cs
Common/DTS.Common/Converters/StringListToVisibilityConverter.cs
Common/DTS.Common/Converters/StatusToBorderThicknessConverter.cs
Common/DTS.Common/Converters/ArrayVisibilityConverter.cs
Common/DTS.Common/Converters/DSPStreamingFilterFrequencyConverter.cs
Common/DTS.Common/Converters/ErrorToColorConverter.cs
Common/DTS.Common/Converters/GreaterThanToBoolConverter.cs
Common/DTS.Common/Converters/BooleanToColorConverter.cs
Common/DTS.Common/Converters/BooleanToItalicFontStyleConverter.cs
Common/DTS.Common/Converters/IntervalToVisibilityConverter.cs
Common/DTS.Common/Converters/StatusToColorConverter.cs
Common/DTS.Common/Converters/DiagStatusShuntColorConverter.cs
Common/DTS.Common/Converters/DiagStatusOffsetColorConverter.cs
Common/DTS.Common/Converters/InverseBooleanToOpacityConverter.cs
Common/DTS.Common/Converters/ColorToSolidColorBrushConverter .cs
Common/DTS.Common/Converters/BooleanAndToVisibiltyMultiConverter.cs
Common/DTS.Common/Converters/BooleanOrToVisibilityMultiConverter.cs
Common/DTS.Common/Converters/DoubleFromThousandthUnitToBaseUnit.cs
Common/DTS.Common/Converters/BooleanToOpacityConverter.cs
Common/DTS.Common/Converters/DASStatusArmTextConverter.cs
Common/DTS.Common/Converters/RecordingModePreTriggerVisibilityConverter.cs
Common/DTS.Common/Converters/EnumBooleanConverter.cs
Common/DTS.Common/Converters/InitialOffsetToIEPESensorOffsetConverter.cs
Common/DTS.Common/Converters/DASStatusColorConverter.cs
Common/DTS.Common/Converters/DASStatusArmColorConverter .cs
Common/DTS.Common/Converters/PercentConverter.cs
Common/DTS.Common/Converters/NumericStringFormatConverter.cs
Common/DTS.Common/Converters/VisibilityToRowHeightConverter.cs
Common/DTS.Common/Converters/GroupImportErrorToStringConverter.cs
Common/DTS.Common/Converters/GroupNameToVisibilityConverter.cs
Common/DTS.Common/Converters/FilePathsToShortStringConverter.cs
Common/DTS.Common/Converters/InverseBooleanConverter.cs
Common/DTS.Common/Converters/EnumDescriptionTypeConverter.cs
2026-04-16T02:53:33.629685+00:00 Qwen/Qwen3-Coder-Next-FP8 1 e705305552eb4c3f

DTS.Common.Converters Module Documentation

1. Purpose

This module provides a collection of WPF IValueConverter and IMultiValueConverter implementations used for data binding in the DTS (Data Acquisition and Test System) application. These converters enable UI elements to dynamically reflect application state by transforming values (e.g., booleans, enums, numbers, dates, collections) into display-appropriate types such as Visibility, Brush, Thickness, Opacity, FontStyle, or formatted strings. They serve as a bridge between domain models and XAML views, reducing logic in view models and centralizing UI presentation rules.

2. Public Interface

All converters implement IValueConverter or IMultiValueConverter and reside in the DTS.Common.Converters namespace.

BooleanToBorderThicknessConverter

  • Signature: public class BooleanToBorderThicknessConverter : IValueConverter
  • Behavior: Converts true1, false2. Used to visually distinguish active/inactive states via border thickness.

BooleanToBorderBrushConverter

  • Signature: public class BooleanToBorderBrushConverter : IValueConverter
  • Behavior: Converts trueBrushesAndColors.Brush_Warning, false/nullBrushes.Transparent.

BooleanToGreenBorderConverter

  • Signature: public class BooleanToGreenBorderConverter : IValueConverter
  • Behavior: Converts trueBrushesAndColors.BrushApplicationStatusPowerGreen, false/nullBrushes.Transparent.

YesNoRadioButtonsConventer (Note: Typo in class name)

  • Signature: public class YesNoRadioButtonsConventer : IValueConverter
  • Behavior:
    • Convert: Returns true if parameter.ToString() == value.ToString() (used to bind radio buttons to enum/string values).
    • ConvertBack: Returns parameter if value == true, else Binding.DoNothing.

BooleanOrMultiConverter

  • Signature: public class BooleanOrMultiConverter : IMultiValueConverter
  • Behavior: Returns true if any input boolean in the array is true; otherwise false. Throws NotImplementedException in ConvertBack.

DateTimeWithMillisecondsToStringConverter

  • Signature: public class DateTimeWithMillisecondsToStringConverter : IValueConverter
  • Behavior: Converts DateTime to string using Utils.Utils.FormatTimeStamp. ConvertBack returns null.

EnumVisibilityConverter

  • Signature: public class EnumVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Visible if value == parameter, else Visibility.Hidden. ConvertBack returns parameter if value == Visibility.Visible, else Binding.DoNothing.

InverseEnumVisibilityConverter

  • Signature: public class InverseEnumVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Hidden if value == parameter, else Visibility.Visible. ConvertBack returns parameter if value == Visibility.Hidden, else Binding.DoNothing.

ActiveContentConverter

  • Signature: public class ActiveContentConverter : IValueConverter
  • Behavior: Returns the input ContentControl unchanged if it is a ContentControl; otherwise Binding.DoNothing. Supports both directions.

FaultedTextConverter

  • Signature: public class FaultedTextConverter : IValueConverter
  • Behavior: Converts trueStrings.Strings.Faulted, falseStrings.Strings.FaultsClear, null/non-bool → Strings.Strings.FaultsClear.

TriggerTextConverter

  • Signature: public class TriggerTextConverter : IValueConverter
  • Behavior: Converts trueStrings.Strings.Triggered, falseStrings.Strings.TriggerClear, null/non-bool → Strings.Strings.TriggerClear.

TriggerColorConverter

  • Signature: public class TriggerColorConverter : IValueConverter
  • Behavior: Converts trueBrushesAndColors.Brush_ApplicationStatus_Failed.Color, falseBrushesAndColors.Brush_ApplicationStatus_Waiting.Color, null/non-bool → Brushes.Transparent.Color.

FaultedColorConverter

  • Signature: public class FaultedColorConverter : IValueConverter
  • Behavior: Converts trueBrushesAndColors.Brush_ApplicationStatus_Failed.Color, falseBrushesAndColors.Brush_ApplicationStatus_Complete.Color, null/non-bool → Brushes.Transparent.Color.

DateConverter

  • Signature: public class DateConverter : IValueConverter
  • Behavior: Converts DateTimeDateTime, null/non-DateTimeStrings.Strings.Table_NA. ConvertBack behaves similarly.

NullableFloatConverter

  • Signature: public class NullableFloatConverter : IValueConverter
  • Behavior: Converts doubledouble, floatfloat, null/other → string.Empty. ConvertBack returns float or string.Empty.

InverseEnumEnabledConverter

  • Signature: public class InverseEnumEnabledConverter : IValueConverter
  • Behavior: Returns false if value == parameter, else true. Used for IsEnabled. ConvertBack returns parameter if value == false, else Binding.DoNothing.

IsLessThanConverter

  • Signature: public class IsLessThanConverter : IValueConverter
  • Behavior: Compares value < parameter (both parsed as decimal). Defaults to 0 if parsing fails. Returns bool. ConvertBack returns DependencyProperty.UnsetValue.

ListToStringConverter

  • Signature: public class ListToStringConverter : IValueConverter
  • Behavior: Converts List<string> → comma-separated string. Throws InvalidOperationException if targetType != typeof(string) or input is null. ConvertBack throws NotImplementedException.

IsGreaterThanConverter

  • Signature: public class IsGreaterThanConverter : IValueConverter
  • Behavior: Compares value > parameter (both parsed as decimal). Defaults to 0 if parsing fails. Returns bool. ConvertBack returns DependencyProperty.UnsetValue.

NonZeroToColorConverter

  • Signature: public class NonZeroToColorConverter : IValueConverter
  • Behavior:
    • "0"BrushesAndColors.BrushApplicationStatusPowerGreen
    • "---"BrushesAndColors.BrushApplicationStatusPowerClear
    • Other → BrushesAndColors.BrushApplicationStatusPowerRed

HeightConverter

  • Signature: public class HeightConverter : MarkupExtension, IValueConverter
  • Behavior: Returns value - parameter (both parsed as double/int). Implements MarkupExtension for XAML usage (singleton instance). ConvertBack returns null.

ErrorToBooleanConverter

  • Signature: internal class ErrorToBooleanConverter : IValueConverter
  • Behavior: Returns true if value is string.IsNullOrEmpty, else null. ConvertBack throws NotImplementedException.

WidthConverter

  • Signature: public class WidthConverter : MarkupExtension, IValueConverter
  • Behavior: Returns value * parameter (both parsed as double). Implements MarkupExtension. ConvertBack throws NotImplementedException.

StringListToVisibilityConverter

  • Signature: public class StringListToVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Visible if List<string> is non-empty, else Visibility.Collapsed. Throws InvalidOperationException if targetType != typeof(Visibility) or input is null. ConvertBack throws NotImplementedException.

StatusToBorderThicknessConverter

  • Signature: public class StatusToBorderThicknessConverter : IValueConverter
  • Behavior: Maps UIItemStatus to border thickness: None1, all others (Success, Failed, Error, Warning) → 2. Non-UIItemStatus1.

ArrayVisibilityConverter

  • Signature: public class ArrayVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Hidden if null, Visibility.Visible if IList.Count > 0 or Array.Length > 0, else Visibility.Visible.

DSPStreamingFilterFrequencyConverter

  • Signature: public class DSPStreamingFilterFrequencyConverter : IValueConverter
  • Behavior:
    • double.NaNstring.Empty
    • 0.0 (within EPSILON = 0.00001) → Strings.Strings.Table_NA
    • Otherwise → formatted as "F1" (e.g., "123.4")
  • ConvertBack: Returns parameter if value == true, else Binding.DoNothing.

ErrorToColorConverter

  • Signature: public class ErrorToColorConverter : IValueConverter
  • Behavior: Returns Brushes.Red if value is non-empty string, else Brushes.Black. Non-string input → Brushes.Black. ConvertBack throws NotImplementedException.

GreaterThanToBoolConverter

  • Signature: public class GreaterEqualThanToBoolConverter : IValueConverter
  • Behavior: Returns true if value >= parameter for int, double, or ushort types. Returns false otherwise. ConvertBack returns false.

BooleanToColorConverter

  • Signature: public class BooleanToColorConverter : IValueConverter
  • Behavior: Configurable via properties:
    • Inverted: Inverts input boolean.
    • Background: If true, returns Brushes.Transparent for true.
    • AttentionBrush: If true, returns BrushesAndColors.Brush_Attention for false.
    • WarningBrush: If true, returns BrushesAndColors.Brush_Warning for false.
    • Default: trueBrush_NoError, falseBrush_Error.

BooleanToItalicFontStyleConverter

  • Signature: public class BooleanToItalicFontStyleConverter : IValueConverter
  • Behavior: Converts trueFontStyles.Italic, false/nullFontStyles.Normal.

IntervalToVisibilityConverter

  • Signature: public class IntervalToVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Visible if value >= parameter (for int, double, ushort), else Visibility.Collapsed. ConvertBack returns false.

StatusToColorConverter

  • Signature: public class StatusToColorConverter : IValueConverter
  • Behavior: Maps UIItemStatus to color:
    • NoneBrushes.Black
    • SuccessBrush_ApplicationStatus_Complete
    • Failed/ErrorBrush_ApplicationStatus_Failed/Brushes.Red
    • WarningBrushes.OrangeRed
    • Default → Brushes.Transparent.

DiagStatusShuntColorConverter

  • Signature: public class DiagStatusShuntColorConverter : IValueConverter
  • Behavior: Maps DiagStatuses:
    • NoResultsBrush_ApplicationStatus_Idle
    • FailedShunt bit set → Brush_ApplicationStatus_Failed
    • Otherwise → Brush_ApplicationStatus_Complete
    • Default → Brush_ApplicationStatus_Idle.

DiagStatusOffsetColorConverter

  • Signature: public class DiagStatusOffsetColorConverter : IValueConverter
  • Behavior: Same logic as DiagStatusShuntColorConverter, but checks FailedOffset bit.

InverseBooleanToOpacityConverter

  • Signature: public class InverseBooleanToOpacityConverter : IValueConverter
  • Behavior: Converts true1.0, false/null0.5.

ColorToSolidColorBrushConverter

  • Signature: public class ColorToSolidColorBrushConverter : IValueConverter
  • Behavior: Converts ColorSolidColorBrush. Non-Color input → null. ConvertBack throws NotImplementedException.

BooleanAndToVisibilityMultiConverter

  • Signature: public class BooleanAndToVisibilityMultiConverter : IMultiValueConverter
  • Behavior: Returns Visibility.Visible if all inputs are true. Supports parameter flags:
    • "FALSE": Invert logic (false → visible).
    • "HIDE": Use Visibility.Hidden instead of Collapsed.
  • ConvertBack throws NotImplementedException.

BooleanOrToVisibilityMultiConverter

  • Signature: public class BooleanOrToVisibilityMultiConverter : IMultiValueConverter
  • Behavior: Returns Visibility.Visible if any input is true. Same parameter flags as BooleanAndToVisibilityMultiConverter.
  • ConvertBack throws NotImplementedException.

DoubleFromThousandthUnitToBaseUnit

  • Signature: public class DoubleFromThousandthUnitToBaseUnit : IValueConverter
  • Behavior: Converts thousandths to base unit (e.g., mV → V): value / 1000. ConvertBack: value * 1000. double.NaN0D.

BooleanToOpacityConverter

  • Signature: public class BooleanToOpacityConverter : IValueConverter
  • Behavior: Converts true0.5, false/null1.0. Used for disabled/enabled visual feedback.

DASStatusArmTextConverter

  • Signature: public class DASStatusArmTextConverter : IValueConverter
  • Behavior: Maps DASStatuses to text:
    • MissingNotBooted, BootedNotArmedYet, BootedNeverArmed, ReadyForDownloadStrings.Strings.Table_NA/Strings.Strings.NotArmed
    • ArmedReady, ArmedButFailedDiagStrings.Strings.Armed
    • Default → Strings.Strings.Table_NA.

RecordingModePreTriggerVisibilityConverter

  • Signature: public class RecordingModePreTriggerVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Visible if pre-trigger should be shown (i.e., RecordingModes is active or can program pre-trigger). parameter = "True" inverts result.

EnumBooleanConverter

  • Signature: public class EnumBooleanConverter : IValueConverter
  • Behavior: Returns true if value.Equals(parameter). ConvertBack: Returns parameter if value == true, else Binding.DoNothing.

InitialOffsetToIEPESensorOffsetConverter

  • Signature: public class InitialOffsetToIEPESensorOffsetConverter : IValueConverter
  • Behavior: Converts millivolt offset to IEPE sensor offset (volts): (milliUnit / 1000) + 12.25. ConvertBack: (unit - 12.25) * 1000. double.NaN0D.

DASStatusColorConverter

  • Signature: public class DASStatusColorConverter : IValueConverter
  • Behavior: Maps DASStatuses to color:
    • MissingNotBootedBrush_ApplicationStatus_Idle
    • BootedNotArmedYetBrush_ApplicationStatus_Busy
    • BootedNeverArmed, ArmedButFailedDiagBrush_ApplicationStatus_Failed
    • ArmedReady, ReadyForDownloadBrush_ApplicationStatus_Complete
    • Default → Brush_ApplicationStatus_Idle.

DASStatusArmColorConverter

  • Signature: public class DASStatusArmColorConverter : IValueConverter
  • Behavior: Maps DASStatuses to color:
    • MissingNotBooted, BootedNotArmedYet, BootedNeverArmedBrush_ApplicationStatus_Failed
    • ArmedReadyBrush_ApplicationStatus_Complete
    • ArmedButFailedDiagBrush_ApplicationStatus_Busy
    • ReadyForDownloadBrush_ApplicationStatus_Idle
    • Default → Brush_ApplicationStatus_Idle.

PercentConverter

  • Signature: public class PercentConverter : IValueConverter
  • Behavior: Converts decimal? → formatted string "{value:F1}%". Defaults to 0 if null. ConvertBack throws NotImplementedException.

NumericStringFormatConverter

  • Signature: public class NumericStringFormatConverter : IMultiValueConverter
  • Behavior: Converts first value (int/double/float/decimal) to string using format string from second value. NaNStrings.Strings.Table_NA. ConvertBack throws NotImplementedException.

VisibilityToRowHeightConverter

  • Signature: public class VisibilityToRowHeightConverter : DependencyObject, IValueConverter
  • Behavior:
    • Visibility.Collapsed0
    • Other → parameter (default 0 if null)
    • InvertSource property inverts VisibleCollapsed before conversion.

GroupImportErrorToStringConverter

  • Signature: public class GroupImportErrorToStringConverter : IValueConverter
  • Behavior: Returns GroupImportError.ExtraInfo if input is non-null GroupImportError, else string.Empty. ConvertBack throws NotImplementedException.

GroupNameToVisibilityConverter

  • Signature: public class GroupNameToVisibilityConverter : IValueConverter
  • Behavior: Returns Visibility.Visible if value.ToString().Trim() starts with "Graph", else Visibility.Collapsed.

FilePathsToShortStringConverter

  • Signature: public class FilePathsToShortStringConverter : IValueConverter
  • Behavior:
    • null/empty array → string.Empty
    • Multiple files → Strings.Strings.MultipleFiles
    • Single file → FileInfo.Name

InverseBooleanConverter

  • Signature: public class InverseBooleanConverter : IValueConverter
  • Behavior: Inverts boolean (via bool.TryParse). nullfalse. Supports two-way binding.

EnumDescriptionTypeConverter

  • Signature: public class EnumDescriptionTypeConverter : EnumConverter
  • Behavior: Overrides ConvertTo to return localized enum descriptions (via `DescriptionAttribute