private void RefreshUIAngles()
{
if (double.IsNaN(_startDegree)
|| double.IsNaN(_endDegree))
{
return;
}
Debug.Assert(_startDegree >= 0 && _startDegree <= 360.0);
Debug.Assert(_endDegree >= 0 && _endDegree <= 360.0);
Debug.Assert(_startDegree <= _endDegree);
xRotation.Angle = _startDegree;
double arcAngle = _endDegree - _startDegree;
double arcAngleRadians = arcAngle * Math.PI / 180.0;
double arcAngleRemapped = (arcAngleRadians - Math.PI * 0.5) * -1.0;
double endX = Math.Cos(arcAngleRemapped) * 50 + 50;
double endY = Math.Sin(arcAngleRemapped) * -50 + 50;
xArc.Point = new Point(endX, endY);
if (arcAngle >= 180.0)
{
xArc.IsLargeArc = true;
}
else
{
xArc.IsLargeArc = false;
}
// Update child content placement.
{
double angleMidpoint = (_startDegree + _endDegree) * 0.5;
xChildRotation.Angle = angleMidpoint;
}
}