예제 #1
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (!ObjectValueArrayHelper.TryExtractValues(values.Take(4), out var doubles))
            {
                return(Binding.DoNothing);
            }

            var actualWidth = doubles[0];
            var value       = doubles[1];
            var minimum     = doubles[2];
            var maximum     = doubles[3];

            if (values.Length == 5)
            {
                var fullIndeterminateScaling = ObjectValueArrayHelper.ExtractDouble(values[4]);
                if (!double.IsNaN(fullIndeterminateScaling) && fullIndeterminateScaling > 0.0)
                {
                    value = (maximum - minimum) * fullIndeterminateScaling;
                }
            }

            var percent = maximum <= minimum ? 1.0 : (value - minimum) / (maximum - minimum);
            var degrees = 360 * percent;
            var radians = degrees * (Math.PI / 180);

            var centre           = new Point(actualWidth / 2, actualWidth / 2);
            var hypotenuseRadius = (actualWidth / 2);

            var adjacent = Math.Cos(radians) * hypotenuseRadius;
            var opposite = Math.Sin(radians) * hypotenuseRadius;

            return(new Point(centre.X + opposite, centre.Y - adjacent));
        }
예제 #2
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (!ObjectValueArrayHelper.TryExtractValues(values, out var doubles))
            {
                return(Binding.DoNothing);
            }

            var value   = doubles[0];
            var minimum = doubles[1];
            var maximum = doubles[2];

            var percent = maximum <= minimum ? 1.0 : (value - minimum) / (maximum - minimum);

            return(360 * percent);
        }
예제 #3
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (!ObjectValueArrayHelper.TryExtractValues(values.Take(3), out var doubles))
            {
                return(Binding.DoNothing);
            }

            var value   = doubles[0];
            var minimum = doubles[1];
            var maximum = doubles[2];

            if (values.Length == 4)
            {
                var fullIndeterminateScaling = ObjectValueArrayHelper.ExtractDouble(values[3]);
                if (!double.IsNaN(fullIndeterminateScaling) && fullIndeterminateScaling > 0.0)
                {
                    value = (maximum - minimum) * fullIndeterminateScaling;
                }
            }

            var percent = maximum <= minimum ? 1.0 : (value - minimum) / (maximum - minimum);

            return(percent > 0.5);
        }
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     if (!ObjectValueArrayHelper.TryExtractValues(values.Take(4), out double[] doubles))