コード例 #1
0
        public object Convert(object[] values, Type targetType, object parameter,
                              System.Globalization.CultureInfo culture)
        {
            double value   = (double)values[0];
            double minimum = (double)values[1];
            double maximum = (double)values[2];

            return(CameraHeadingHelper.GetAngle(value, maximum, minimum));
        }
コード例 #2
0
        private void Polygon_MouseMove(object sender, MouseEventArgs e)
        {
            if (_isPressed)
            {
                //Find the parent canvas.
                if (_templateCanvas == null)
                {
                    _templateCanvas = CameraHeadingHelper.FindParent <Canvas>(e.Source as Ellipse);
                    if (_templateCanvas == null)
                    {
                        return;
                    }
                }
                //Calculate the current rotation angle and set the value.
                Point  newPos = e.GetPosition(_templateCanvas);
                double angle  = CameraHeadingHelper.GetAngleR(newPos, RADIUS);
                CameraHeadingControl.Value = (CameraHeadingControl.Maximum - CameraHeadingControl.Minimum) * angle / (2 * Math.PI);

                BindingExpression binding = CameraHeadingControl.GetBindingExpression(Slider.ValueProperty);
                binding.UpdateSource();
            }
        }