|
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
- using System.Windows.Media;
- namespace BPASmartClient.SCADAControl.Converters
- {
- public class Style3ArcConverter :IMultiValueConverter
- {
- public object Convert(object[] values,Type targetType,object parameter,CultureInfo culture)
- {
- double value = (double)values[0];
- double thickness = (double)values[1];
-
- double radius = 40;
-
- double 周长 = Math.PI * (2 * radius - thickness) / thickness;
-
- double showPrecent = value / 100 * 周长;
-
- var converter = TypeDescriptor.GetConverter(typeof(DoubleCollection));
-
- return (DoubleCollection)converter.ConvertFrom($"{showPrecent} {周长}");
- }
-
- public object[] ConvertBack(object value,Type[] targetTypes,object parameter,CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-
- public class Style3DashConverter :IValueConverter
- {
- public object Convert(object value,Type targetType,object parameter,CultureInfo culture)
- {
- double v = (double)value;
-
- if (v == 0)
- {
- return PenLineCap.Flat;
- }
- else
- {
- return PenLineCap.Round;
- }
-
- }
-
- public object ConvertBack(object value,Type targetType,object parameter,CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-
- }
|