diff --git a/src/BlazorWebView/src/SharedSource/BlazorWebViewDeveloperTools.cs b/src/BlazorWebView/src/SharedSource/BlazorWebViewDeveloperTools.cs index 0f088fb3d261..424fd1f3d22d 100644 --- a/src/BlazorWebView/src/SharedSource/BlazorWebViewDeveloperTools.cs +++ b/src/BlazorWebView/src/SharedSource/BlazorWebViewDeveloperTools.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Components.WebView.Maui #endif { internal class BlazorWebViewDeveloperTools - { - public bool Enabled { get; set; } = false; - } +{ + public bool Enabled { get; set; } = false; +} } diff --git a/src/BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs b/src/BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs index 20150d38c056..65765deacd7a 100644 --- a/src/BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs +++ b/src/BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs @@ -54,14 +54,14 @@ public static IMauiBlazorWebViewBuilder AddMauiBlazorWebView(this IServiceCollec #endif } - /// - /// Enables Developer tools on the underlying WebView controls. - /// - /// The . - /// The . - public static IServiceCollection AddBlazorWebViewDeveloperTools(this IServiceCollection services) - { - return services.AddSingleton(new BlazorWebViewDeveloperTools { Enabled = true }); - } +/// +/// Enables Developer tools on the underlying WebView controls. +/// +/// The . +/// The . +public static IServiceCollection AddBlazorWebViewDeveloperTools(this IServiceCollection services) +{ + return services.AddSingleton(new BlazorWebViewDeveloperTools { Enabled = true }); +} } } diff --git a/src/Controls/src/Core/Platform/iOS/DragAndDropDelegate.cs b/src/Controls/src/Core/Platform/iOS/DragAndDropDelegate.cs index fd34a6b6dc98..e637f31d9293 100644 --- a/src/Controls/src/Core/Platform/iOS/DragAndDropDelegate.cs +++ b/src/Controls/src/Core/Platform/iOS/DragAndDropDelegate.cs @@ -21,7 +21,7 @@ public DragAndDropDelegate(IPlatformViewHandler viewHandler) _viewHandler = viewHandler; } - #region UIDragInteractionDelegate +#region UIDragInteractionDelegate [Export("dragInteraction:session:willEndWithOperation:")] [Preserve(Conditional = true)] public void SessionWillEnd(UIDragInteraction interaction, IUIDragSession session, UIDropOperation operation) @@ -39,7 +39,7 @@ public UIDragItem[] GetItemsForBeginningSession(UIDragInteraction interaction, I { return HandleDragStarting((View)_viewHandler.VirtualView, _viewHandler); } - #endregion +#endregion [Export("dropInteraction:canHandleSession:")] [Preserve(Conditional = true)] diff --git a/src/Controls/tests/DeviceTests/Elements/Frame/FrameTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Frame/FrameTests.iOS.cs index a42c70c15704..5a3acd6cc475 100644 --- a/src/Controls/tests/DeviceTests/Elements/Frame/FrameTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Frame/FrameTests.iOS.cs @@ -36,7 +36,7 @@ await InvokeOnMainThreadAsync(() => // so on iOS we just return the shadow that was hard coded into the renderer var expectedShadow = new Shadow() { Radius = 5, Opacity = 0.8f, Offset = new Point(0, 0), Brush = Brush.Black }; - if(platformView.Element is IView element) + if (platformView.Element is IView element) { var platformShadow = element.Shadow; await AssertionExtensions.Wait(() => platformShadow != null); @@ -45,7 +45,7 @@ await InvokeOnMainThreadAsync(() => Assert.Equal(platformShadow.Opacity, expectedShadow.Opacity); Assert.Equal(platformShadow.Offset, expectedShadow.Offset); } - })); + })); } } } \ No newline at end of file diff --git a/src/Essentials/src/Platform/PlatformUtils.android.cs b/src/Essentials/src/Platform/PlatformUtils.android.cs index 9f00b0927e9d..9035fcf75cff 100644 --- a/src/Essentials/src/Platform/PlatformUtils.android.cs +++ b/src/Essentials/src/Platform/PlatformUtils.android.cs @@ -79,7 +79,7 @@ internal static void SetLocale(Java.Util.Locale locale) else #endif #pragma warning disable CS0618 // Type or member is obsolete - config.Locale = locale; + config.Locale = locale; #pragma warning restore CS0618 // Type or member is obsolete #pragma warning disable CS0618 // Type or member is obsolete diff --git a/src/Graphics/src/Graphics.Win2D/W2DCanvas.cs b/src/Graphics/src/Graphics.Win2D/W2DCanvas.cs index 6aded7399e53..9c4d2b6f06a3 100644 --- a/src/Graphics/src/Graphics.Win2D/W2DCanvas.cs +++ b/src/Graphics/src/Graphics.Win2D/W2DCanvas.cs @@ -239,42 +239,42 @@ public override void DrawString(string value, float x, float y, HorizontalAlignm try { #endif - var textFormat = (CurrentState.Font ?? Graphics.Font.Default).ToCanvasTextFormat(CurrentState.FontSize); - textFormat.VerticalAlignment = CanvasVerticalAlignment.Top; + var textFormat = (CurrentState.Font ?? Graphics.Font.Default).ToCanvasTextFormat(CurrentState.FontSize); + textFormat.VerticalAlignment = CanvasVerticalAlignment.Top; - switch (horizontalAlignment) - { - case HorizontalAlignment.Left: - _rect.X = x; - _rect.Width = CanvasSize.Width; - textFormat.HorizontalAlignment = CanvasHorizontalAlignment.Left; - break; - case HorizontalAlignment.Right: - _rect.X = x - CanvasSize.Width; - _rect.Width = CanvasSize.Width; - textFormat.HorizontalAlignment = CanvasHorizontalAlignment.Right; - break; - default: - _rect.X = x - _canvasSize.Width; - _rect.Width = _canvasSize.Width * 2; - textFormat.HorizontalAlignment = CanvasHorizontalAlignment.Center; - break; - } + switch (horizontalAlignment) + { + case HorizontalAlignment.Left: + _rect.X = x; + _rect.Width = CanvasSize.Width; + textFormat.HorizontalAlignment = CanvasHorizontalAlignment.Left; + break; + case HorizontalAlignment.Right: + _rect.X = x - CanvasSize.Width; + _rect.Width = CanvasSize.Width; + textFormat.HorizontalAlignment = CanvasHorizontalAlignment.Right; + break; + default: + _rect.X = x - _canvasSize.Width; + _rect.Width = _canvasSize.Width * 2; + textFormat.HorizontalAlignment = CanvasHorizontalAlignment.Center; + break; + } - _rect.Y = y - CurrentState.FontSize; - _rect.Height = CurrentState.FontSize * 2; + _rect.Y = y - CurrentState.FontSize; + _rect.Height = CurrentState.FontSize * 2; - _point1.X = (float)_rect.X; - _point1.Y = (float)_rect.Y; + _point1.X = (float)_rect.X; + _point1.Y = (float)_rect.Y; - var textLayout = new CanvasTextLayout( - _session, - value, - textFormat, - (float)_rect.Width, - (float)_rect.Height); + var textLayout = new CanvasTextLayout( + _session, + value, + textFormat, + (float)_rect.Width, + (float)_rect.Height); - Draw(ctx => ctx.DrawTextLayout(textLayout, _point1, CurrentState.PlatformFontBrush)); + Draw(ctx => ctx.DrawTextLayout(textLayout, _point1, CurrentState.PlatformFontBrush)); #if DEBUG diff --git a/src/Graphics/src/Graphics.Win2D/W2DExtensions.cs b/src/Graphics/src/Graphics.Win2D/W2DExtensions.cs index 852122636809..545c785b24f9 100644 --- a/src/Graphics/src/Graphics.Win2D/W2DExtensions.cs +++ b/src/Graphics/src/Graphics.Win2D/W2DExtensions.cs @@ -66,122 +66,122 @@ public static CanvasGeometry AsPath(this PathF path, float ox, float oy, float f try { #endif - builder.SetFilledRegionDetermination(fillMode); + builder.SetFilledRegionDetermination(fillMode); - var pointIndex = 0; - var arcAngleIndex = 0; - var arcClockwiseIndex = 0; - var figureOpen = false; - var segmentIndex = -1; + var pointIndex = 0; + var arcAngleIndex = 0; + var arcClockwiseIndex = 0; + var figureOpen = false; + var segmentIndex = -1; - var lastOperation = PathOperation.Move; + var lastOperation = PathOperation.Move; - foreach (var type in path.SegmentTypes) - { - segmentIndex++; - - if (type == PathOperation.Move) - { - if (lastOperation != PathOperation.Close && lastOperation != PathOperation.Move) - { - builder.EndFigure(CanvasFigureLoop.Open); - } + foreach (var type in path.SegmentTypes) + { + segmentIndex++; - var point = path[pointIndex++]; - var begin = CanvasFigureFill.Default; - builder.BeginFigure(ox + point.X * fx, oy + point.Y * fy, begin); - figureOpen = true; - } - else if (type == PathOperation.Line) + if (type == PathOperation.Move) + { + if (lastOperation != PathOperation.Close && lastOperation != PathOperation.Move) { - var point = path[pointIndex++]; - builder.AddLine(ox + point.X * fx, oy + point.Y * fy); + builder.EndFigure(CanvasFigureLoop.Open); } - else if (type == PathOperation.Quad) - { - var controlPoint = path[pointIndex++]; - var endPoint = path[pointIndex++]; + var point = path[pointIndex++]; + var begin = CanvasFigureFill.Default; + builder.BeginFigure(ox + point.X * fx, oy + point.Y * fy, begin); + figureOpen = true; + } + else if (type == PathOperation.Line) + { + var point = path[pointIndex++]; + builder.AddLine(ox + point.X * fx, oy + point.Y * fy); + } + + else if (type == PathOperation.Quad) + { + var controlPoint = path[pointIndex++]; + var endPoint = path[pointIndex++]; + + builder.AddQuadraticBezier( + new Vector2(ox + controlPoint.X * fx, oy + controlPoint.Y * fy), + new Vector2(ox + endPoint.X * fx, oy + endPoint.Y * fy)); + } + else if (type == PathOperation.Cubic) + { + var controlPoint1 = path[pointIndex++]; + var controlPoint2 = path[pointIndex++]; + var endPoint = path[pointIndex++]; + builder.AddCubicBezier( + new Vector2(ox + controlPoint1.X * fx, oy + controlPoint1.Y * fy), + new Vector2(ox + controlPoint2.X * fx, oy + controlPoint2.Y * fy), + new Vector2(ox + endPoint.X * fx, oy + endPoint.Y * fy)); + } + else if (type == PathOperation.Arc) + { + var topLeft = path[pointIndex++]; + var bottomRight = path[pointIndex++]; + var startAngle = path.GetArcAngle(arcAngleIndex++); + var endAngle = path.GetArcAngle(arcAngleIndex++); + var clockwise = path.GetArcClockwise(arcClockwiseIndex++); - builder.AddQuadraticBezier( - new Vector2(ox + controlPoint.X * fx, oy + controlPoint.Y * fy), - new Vector2(ox + endPoint.X * fx, oy + endPoint.Y * fy)); + while (startAngle < 0) + { + startAngle += 360; } - else if (type == PathOperation.Cubic) + + while (endAngle < 0) { - var controlPoint1 = path[pointIndex++]; - var controlPoint2 = path[pointIndex++]; - var endPoint = path[pointIndex++]; - builder.AddCubicBezier( - new Vector2(ox + controlPoint1.X * fx, oy + controlPoint1.Y * fy), - new Vector2(ox + controlPoint2.X * fx, oy + controlPoint2.Y * fy), - new Vector2(ox + endPoint.X * fx, oy + endPoint.Y * fy)); + endAngle += 360; } - else if (type == PathOperation.Arc) + + var rotation = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); + var absRotation = Math.Abs(rotation); + + var rectX = ox + topLeft.X * fx; + var rectY = oy + topLeft.Y * fy; + var rectWidth = (ox + bottomRight.X * fx) - rectX; + var rectHeight = (oy + bottomRight.Y * fy) - rectY; + + var startPoint = GeometryUtil.EllipseAngleToPoint(rectX, rectY, rectWidth, rectHeight, -startAngle); + var endPoint = GeometryUtil.EllipseAngleToPoint(rectX, rectY, rectWidth, rectHeight, -endAngle); + + + if (!figureOpen) { - var topLeft = path[pointIndex++]; - var bottomRight = path[pointIndex++]; - var startAngle = path.GetArcAngle(arcAngleIndex++); - var endAngle = path.GetArcAngle(arcAngleIndex++); - var clockwise = path.GetArcClockwise(arcClockwiseIndex++); - - while (startAngle < 0) - { - startAngle += 360; - } - - while (endAngle < 0) - { - endAngle += 360; - } - - var rotation = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); - var absRotation = Math.Abs(rotation); - - var rectX = ox + topLeft.X * fx; - var rectY = oy + topLeft.Y * fy; - var rectWidth = (ox + bottomRight.X * fx) - rectX; - var rectHeight = (oy + bottomRight.Y * fy) - rectY; - - var startPoint = GeometryUtil.EllipseAngleToPoint(rectX, rectY, rectWidth, rectHeight, -startAngle); - var endPoint = GeometryUtil.EllipseAngleToPoint(rectX, rectY, rectWidth, rectHeight, -endAngle); - - - if (!figureOpen) - { - var begin = CanvasFigureFill.Default; - builder.BeginFigure(startPoint.X, startPoint.Y, begin); - figureOpen = true; - } - else - { - builder.AddLine(startPoint.X, startPoint.Y); - } - - builder.AddArc( - new Vector2(endPoint.X, endPoint.Y), - rectWidth / 2, - rectHeight / 2, - 0, - clockwise ? CanvasSweepDirection.Clockwise : CanvasSweepDirection.CounterClockwise, - absRotation >= 180 ? CanvasArcSize.Large : CanvasArcSize.Small - ); + var begin = CanvasFigureFill.Default; + builder.BeginFigure(startPoint.X, startPoint.Y, begin); + figureOpen = true; } - else if (type == PathOperation.Close) + else { - builder.EndFigure(CanvasFigureLoop.Closed); + builder.AddLine(startPoint.X, startPoint.Y); } - lastOperation = type; + builder.AddArc( + new Vector2(endPoint.X, endPoint.Y), + rectWidth / 2, + rectHeight / 2, + 0, + clockwise ? CanvasSweepDirection.Clockwise : CanvasSweepDirection.CounterClockwise, + absRotation >= 180 ? CanvasArcSize.Large : CanvasArcSize.Small + ); } - - if (segmentIndex >= 0 && lastOperation != PathOperation.Close) + else if (type == PathOperation.Close) { - builder.EndFigure(CanvasFigureLoop.Open); + builder.EndFigure(CanvasFigureLoop.Closed); } - var geometry = CanvasGeometry.CreatePath(builder); - return geometry; + lastOperation = type; + } + + if (segmentIndex >= 0 && lastOperation != PathOperation.Close) + { + builder.EndFigure(CanvasFigureLoop.Open); + } + + var geometry = CanvasGeometry.CreatePath(builder); + return geometry; #if DEBUG } catch (Exception exc)