You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
699 B
26 lines
699 B
using System.Globalization; |
|
using Avalonia.Data.Converters; |
|
using Microsoft.Extensions.Logging; |
|
|
|
namespace StabilityMatrix.Avalonia.Diagnostics.LogViewer.Converters; |
|
|
|
public class EventIdConverter : IValueConverter |
|
{ |
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) |
|
{ |
|
if (value is null) |
|
return "0"; |
|
|
|
var eventId = (EventId)value; |
|
|
|
return eventId.ToString(); |
|
} |
|
|
|
// If not implemented, an error is thrown |
|
public object ConvertBack( |
|
object? value, |
|
Type targetType, |
|
object? parameter, |
|
CultureInfo culture |
|
) => new EventId(0, value?.ToString() ?? string.Empty); |
|
}
|
|
|