WaveProgressValueConverter.cs 599 B

123456789101112131415161718192021
  1. using System;
  2. using System.Globalization;
  3. using Avalonia.Data.Converters;
  4. namespace SukiUI.Converters.WaveProgress;
  5. public class WaveProgressValueConverter : IValueConverter
  6. {
  7. public static readonly WaveProgressValueConverter Instance = new();
  8. public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
  9. {
  10. if (value is not double i) return 0;
  11. return 155 - i * 2.1;
  12. }
  13. public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
  14. {
  15. throw new NotSupportedException();
  16. }
  17. }