Skip to content

Commit

Permalink
conversion to .net 5
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyCorbett committed Mar 22, 2021
1 parent 2458e80 commit 473554e
Show file tree
Hide file tree
Showing 96 changed files with 910 additions and 901 deletions.
22 changes: 11 additions & 11 deletions OnlyT.AnalogueClock/ClockControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,26 +339,26 @@ private static Point PointOnCircle(double radius, double angleInDegrees, Point o
return new Point(x, y);
}

private double CalculateAngleSeconds(DateTime dt)
private static double CalculateAngleSeconds(DateTime dt)
{
return dt.Second * 6;
}

private double CalculateAngleMinutes(DateTime dt)
private static double CalculateAngleMinutes(DateTime dt)
{
return
(dt.Minute * 6) +
(dt.Second * 0.1) +
(dt.Millisecond * 0.0001);
}

private double CalculateAngleHours(DateTime dt)
private static double CalculateAngleHours(DateTime dt)
{
var hr = dt.Hour >= 12 ? dt.Hour - 12 : dt.Hour;
return (hr * 30) + (((double)dt.Minute / 60) * 30);
}

private void PositionClockHand(Line hand, double angle, double shadowOpacity)
private static void PositionClockHand(Line hand, double angle, double shadowOpacity)
{
((DropShadowEffect)hand.Effect).Opacity = shadowOpacity;
((DropShadowEffect)hand.Effect).Direction = angle;
Expand Down Expand Up @@ -486,7 +486,7 @@ private void AnimationCallback(object? sender, EventArgs eventArgs)
}
}

private double AnimateHand(Line hand, double currentAngle, double targetAngle, double shadowOpacity)
private static double AnimateHand(Line hand, double currentAngle, double targetAngle, double shadowOpacity)
{
if (Math.Abs(currentAngle - targetAngle) > AngleTolerance)
{
Expand All @@ -512,7 +512,7 @@ private bool AnimationShouldContinue()
Math.Abs(_animationCurrentAngles.HoursAngle - _animationTargetAngles.HoursAngle) > AngleTolerance;
}

private TextBlock CreateHourNumberTextBlock(int hour)
private static TextBlock CreateHourNumberTextBlock(int hour)
{
return new()
{
Expand All @@ -525,7 +525,7 @@ private TextBlock CreateHourNumberTextBlock(int hour)
};
}

private void GenerateHourNumbers(Canvas canvas)
private static void GenerateHourNumbers(Canvas canvas)
{
double clockRadius = canvas.Width / 2;
double centrePointRadius = clockRadius - 50;
Expand All @@ -552,7 +552,7 @@ private void GenerateHourNumbers(Canvas canvas)
}
}

private void GenerateHourMarkers(Canvas canvas)
private static void GenerateHourMarkers(Canvas canvas)
{
var angle = 0;
for (var n = 0; n < 4; ++n)
Expand Down Expand Up @@ -588,7 +588,7 @@ private void GenerateHourMarkers(Canvas canvas)
}
}

private Line CreateMajorHourMarker()
private static Line CreateMajorHourMarker()
{
return new()
{
Expand All @@ -601,7 +601,7 @@ private Line CreateMajorHourMarker()
};
}

private Line CreateMinorHourMarker()
private static Line CreateMinorHourMarker()
{
return new()
{
Expand All @@ -614,7 +614,7 @@ private Line CreateMinorHourMarker()
};
}

private Line CreateMinuteMarker()
private static Line CreateMinuteMarker()
{
return new()
{
Expand Down
16 changes: 8 additions & 8 deletions OnlyT.CountdownTimer/Animations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ private static DoubleAnimation CreateFadeAnimation(FrameworkElement ctrl, int ms

return animation;
}


private static void Fade(FrameworkElement parentContainer, FrameworkElement ctrl, int ms, bool fadeIn, EventHandler? onCompleted = null)
{
var storyboard = new Storyboard();
storyboard.Children.Add(CreateFadeAnimation(ctrl, ms, fadeIn, onCompleted));
storyboard.Begin(parentContainer);
}

private static void Fade(FrameworkElement parentContainer, FrameworkElement[] ctrls, int ms, bool fadeIn, EventHandler? onCompleted = null)
{
var storyboard = new Storyboard();
Expand Down Expand Up @@ -197,12 +204,5 @@ private static void Slide(FrameworkElement parentContainer, FrameworkElement ctr

storyboard.Begin(parentContainer);
}

private static void Fade(FrameworkElement parentContainer, FrameworkElement ctrl, int ms, bool fadeIn, EventHandler? onCompleted = null)
{
var storyboard = new Storyboard();
storyboard.Children.Add(CreateFadeAnimation(ctrl, ms, fadeIn, onCompleted));
storyboard.Begin(parentContainer);
}
}
}
Loading

0 comments on commit 473554e

Please sign in to comment.