Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
pomianowski committed May 5, 2024
1 parent 8ebf43e commit ef742b5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 34 deletions.
53 changes: 29 additions & 24 deletions src/Wpf.Ui/Controls/Arc/Arc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
using System.Windows.Shapes;
using Point = System.Windows.Point;
using Size = System.Windows.Size;
// ReSharper disable CheckNamespace
#pragma warning disable CS0108

// ReSharper disable CheckNamespace
namespace Wpf.Ui.Controls;

/// <summary>
Expand Down Expand Up @@ -46,22 +45,20 @@ public class Arc : Shape
);

/// <summary>Identifies the <see cref="SweepDirection"/> dependency property.</summary>
public static readonly DependencyProperty SweepDirectionProperty =
DependencyProperty.Register(
nameof(SweepDirection),
typeof(SweepDirection),
typeof(Arc),
new PropertyMetadata(SweepDirection.Clockwise, PropertyChangedCallback)
);
public static readonly DependencyProperty SweepDirectionProperty = DependencyProperty.Register(
nameof(SweepDirection),
typeof(SweepDirection),
typeof(Arc),
new PropertyMetadata(SweepDirection.Clockwise, PropertyChangedCallback)
);

/// <summary>Identifies the <see cref="StrokeStartLineCap"/> dependency property.</summary>
public static readonly DependencyProperty StrokeStartLineCapProperty =
DependencyProperty.Register(
nameof(StrokeStartLineCap),
typeof(PenLineCap),
typeof(Arc),
new PropertyMetadata(PenLineCap.Round, PropertyChangedCallback)
);
public static readonly DependencyProperty StrokeStartLineCapProperty = DependencyProperty.Register(

Check warning on line 56 in src/Wpf.Ui/Controls/Arc/Arc.cs

View workflow job for this annotation

GitHub Actions / build

'Arc.StrokeStartLineCapProperty' hides inherited member 'Shape.StrokeStartLineCapProperty'. Use the new keyword if hiding was intended.
nameof(StrokeStartLineCap),
typeof(PenLineCap),
typeof(Arc),
new PropertyMetadata(PenLineCap.Round, PropertyChangedCallback)
);

/// <summary>
/// Gets or sets the initial angle from which the arc will be drawn.
Expand Down Expand Up @@ -90,7 +87,8 @@ public SweepDirection SweepDirection
set => SetValue(SweepDirectionProperty, value);
}

public PenLineCap StrokeStartLineCap
// TODO: Should we?
public new PenLineCap StrokeStartLineCap
{
get { return (PenLineCap)GetValue(StrokeStartLineCapProperty); }
set { SetValue(StrokeStartLineCapProperty, value); }
Expand Down Expand Up @@ -165,7 +163,10 @@ protected Point PointAtAngle(double angle)
var xRadius = (RenderSize.Width - StrokeThickness) / 2;
var yRadius = (RenderSize.Height - StrokeThickness) / 2;

return new Point(xRadius + (xRadius * Math.Cos(radAngle)), yRadius - (yRadius * Math.Sin(radAngle)));
return new Point(
xRadius + (xRadius * Math.Cos(radAngle)),
yRadius - (yRadius * Math.Sin(radAngle))
);
}
else
{
Expand All @@ -180,7 +181,10 @@ protected Point PointAtAngle(double angle)
var xRadius = (RenderSize.Width - StrokeThickness) / 2;
var yRadius = (RenderSize.Height - StrokeThickness) / 2;

return new Point(xRadius + (xRadius * Math.Cos(-radAngle)), yRadius - (yRadius * Math.Sin(-radAngle)));
return new Point(
xRadius + (xRadius * Math.Cos(-radAngle)),
yRadius - (yRadius * Math.Sin(-radAngle))
);
}
}

Expand Down Expand Up @@ -231,11 +235,12 @@ protected override Size ArrangeOverride(Size finalSize)
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
Pen pen = new(Stroke, StrokeThickness)
{
StartLineCap = StrokeStartLineCap,
EndLineCap = StrokeStartLineCap
};
Pen pen =
new(Stroke, StrokeThickness)
{
StartLineCap = StrokeStartLineCap,
EndLineCap = StrokeStartLineCap
};

drawingContext.DrawGeometry(Stroke, pen, DefinedGeometry());
}
Expand Down
13 changes: 8 additions & 5 deletions src/Wpf.Ui/Markup/FontIconExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ namespace Wpf.Ui.Markup;
[MarkupExtensionReturnType(typeof(FontIcon))]
public class FontIconExtension : MarkupExtension
{
public FontIconExtension()
{
}
public FontIconExtension() { }

public FontIconExtension(string glyph)
{
Expand All @@ -51,7 +49,12 @@ public FontIconExtension(string glyph)

public override object ProvideValue(IServiceProvider serviceProvider)
{
if (serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget { TargetObject: Setter })
if (
serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget
{
TargetObject: Setter
}
)
{
return this;
}
Expand All @@ -65,4 +68,4 @@ public override object ProvideValue(IServiceProvider serviceProvider)

return fontIcon;
}
}
}
12 changes: 7 additions & 5 deletions src/Wpf.Ui/Markup/SymbolIconExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ namespace Wpf.Ui.Markup;
[MarkupExtensionReturnType(typeof(SymbolIcon))]
public class SymbolIconExtension : MarkupExtension
{

public SymbolIconExtension()
{
}
public SymbolIconExtension() { }

public SymbolIconExtension(SymbolRegular symbol)
{
Expand Down Expand Up @@ -63,7 +60,12 @@ public SymbolIconExtension(SymbolRegular symbol, bool filled)

public override object ProvideValue(IServiceProvider serviceProvider)
{
if (serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget { TargetObject: Setter })
if (
serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget
{
TargetObject: Setter
}
)
{
return this;
}
Expand Down

0 comments on commit ef742b5

Please sign in to comment.