Class StatusTextToColorConverter

Maps a free-form device/pipeline status to a themed status brush, by keyword. Accepts either a status STRING (e.g. "Idle", "Streaming", "Disconnected", "Waiting for probe...") or a status ENUM (its name is used — e.g. HannesHand's DeviceStatus.Ready/DongleReady/Error). Use for status badges whose source is not the BlockStatus enum (which has StatusToColorConverter). Order matters: error keywords are checked first, then the transient/amber set before the green set so "Disconnected", "Connecting" and "DongleReady" do not read as a healthy connection.

Inheritance
StatusTextToColorConverter
Implements
IValueConverter
Namespace: MOSAIC.Converters
Assembly: MOSAIC.dll
Syntax
public class StatusTextToColorConverter : IValueConverter

Methods

Convert(object?, Type, object?, CultureInfo)

Converts a value.

Declaration
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
Type Name Description
object value

The value to convert.

Type targetType

The type of the target.

object parameter

A user-defined parameter.

CultureInfo culture

The culture to use.

Returns
Type Description
object

The converted value.

Remarks

This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.

ConvertBack(object?, Type, object?, CultureInfo)

Converts a value.

Declaration
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
Type Name Description
object value

The value to convert.

Type targetType

The type of the target.

object parameter

A user-defined parameter.

CultureInfo culture

The culture to use.

Returns
Type Description
object

The converted value.

Remarks

This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.

ResolveBrush(string)

Declaration
private static ISolidColorBrush ResolveBrush(string key)
Parameters
Type Name Description
string key
Returns
Type Description
ISolidColorBrush

Implements

Avalonia.Data.Converters.IValueConverter

Search documentation

Start typing to search the documentation.