Class ConsoleBrushConverter
- Namespace
- McServerLauncher.ViewModels
- Assembly
- McServerLauncher.dll
A console line's kind to the brush it is drawn in.
public class ConsoleBrushConverter : IValueConverter
- Inheritance
-
ConsoleBrushConverter
- Implements
-
IValueConverter
- Inherited Members
Remarks
A converter rather than a brush stored on every line, for the reason that only shows up later: the console holds two thousand lines, and a colour the user changes in the settings has to reach all of them. Storing a brush per line means walking two thousand objects to repaint; asking a converter means the change arrives for free the next time each visible row is drawn.
Reads the app-wide settings rather than a server's own. The per-server notification override decides which notifications appear for that server, which is a different question from what colour a log line is; a console that changed palette depending on which server was selected would be a curiosity, not a feature.
Fields
Instance
public static readonly ConsoleBrushConverter Instance
Field Value
Methods
Convert(object?, Type, object?, CultureInfo)
Converts a value.
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
valueobjectThe value to convert.
targetTypeTypeThe type of the target.
parameterobjectA user-defined parameter.
cultureCultureInfoThe culture to use.
Returns
- 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.
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
valueobjectThe value to convert.
targetTypeTypeThe type of the target.
parameterobjectA user-defined parameter.
cultureCultureInfoThe culture to use.
Returns
- 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.