using Avalonia.Data.Converters; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ShakerApp.Convert { internal class MemoryConverter : IValueConverter { private object? lastv = null; public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { lastv = value; double exp = 1000; if(parameter!= null && double.TryParse(parameter.ToString(),out exp)) { } if (value == null) return "0"; if(double.TryParse(value.ToString(),out var val)) { return Shaker.Models.Tools.Tools.ValueChangeToSI(val,exp,2,"B"); } return "0"; } public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { return lastv; } } }