PenValveStartValueConverter.cs 706 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Data;
  7. namespace Venus_Themes.Converters
  8. {
  9. internal class PenValveStartValueConverter : IValueConverter
  10. {
  11. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  12. {
  13. if (value == null) return 0.0;
  14. var position = (int)value *360/1000;
  15. return 90 - position / 2;
  16. }
  17. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  18. {
  19. return null;
  20. }
  21. }
  22. }