1234567891011121314151617181920212223242526272829 |
- using System;
- using System.Windows.Data;
- using Venus_Core;
- namespace Venus_MainPages.Converters
- {
- public class MFCErrorConverters : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (values == null) return string.Empty;
- float setPoint = (float)(values[0]);
- float calculate = (float)(values[1]);
- if (calculate == 0)
- {
- return "0";
- }
- float deviation = (Math.Abs(calculate) - Math.Abs(setPoint)) / Math.Abs(setPoint) * 100;
-
- return deviation.ToString();
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|