Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet format src/Core/src/Core.csproj #20387

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Core/src/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public static int IndexOf<T>(this IEnumerable<T> enumerable, T item)
if (enumerable == null)
throw new ArgumentNullException(nameof(enumerable));

if (enumerable is IList<T> list)
return list.IndexOf(item);
if (enumerable is IList<T> list)
return list.IndexOf(item);

if (enumerable is T[] array)
return Array.IndexOf(array, item);
if (enumerable is T[] array)
return Array.IndexOf(array, item);

var i = 0;
foreach (T element in enumerable)
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Fonts/EmbeddedFontLoader.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public partial class EmbeddedFontLoader
{
_serviceProvider?.CreateLogger<FontManager>()?.LogWarning(ex, "Unable copy font {Font} to local file system.", font.FontName);

if (newFile != null)
newFile.DeleteAsync().AsTask().Wait();
newFile?.DeleteAsync().AsTask().Wait();
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void OnEditorAction(object? sender, EditorActionEventArgs e)
VirtualView?.Completed();
}
// InputPaneView Path
else if(evt?.KeyCode is null && (actionId == ImeAction.Done || actionId == currentInputImeFlag))
else if (evt?.KeyCode is null && (actionId == ImeAction.Done || actionId == currentInputImeFlag))
{
VirtualView?.Completed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ void UpdateFlyout()
if (_flyoutView == newFlyoutView)
return;

if (_flyoutView != null)
_flyoutView.RemoveFromParent();
_flyoutView?.RemoveFromParent();

_flyoutView = newFlyoutView;
if (_flyoutView == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public static void MapBackground(ISwipeItemMenuItemHandler handler, ISwipeItemMe
public static void MapVisibility(ISwipeItemMenuItemHandler handler, ISwipeItemMenuItem view)
{
var swipeView = handler.PlatformView.Parent.GetParentOfType<MauiSwipeView>();
if (swipeView != null)
swipeView.UpdateIsVisibleSwipeItem(view);
swipeView?.UpdateIsVisibleSwipeItem(view);

handler.PlatformView.Visibility = view.Visibility.ToPlatformVisibility();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public static void MapVisibility(ISwipeItemMenuItemHandler handler, ISwipeItemMe
{
var swipeView = handler.PlatformView.GetParentOfType<MauiSwipeView>();

if (swipeView != null)
swipeView.UpdateIsVisibleSwipeItem(view);
swipeView?.UpdateIsVisibleSwipeItem(view);

handler.PlatformView.UpdateVisibility(view.Visibility);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public static void MapContent(ISwipeItemViewHandler handler, ISwipeItemView page
public static void MapVisibility(ISwipeItemViewHandler handler, ISwipeItemView view)
{
var swipeView = handler.PlatformView?.Parent.GetParentOfType<MauiSwipeView>();
if (swipeView != null)
swipeView.UpdateIsVisibleSwipeItem(view);
swipeView?.UpdateIsVisibleSwipeItem(view);
}

protected override void DisconnectHandler(ContentViewGroup platformView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public static void MapContent(ISwipeItemViewHandler handler, ISwipeItemView page
public static void MapVisibility(ISwipeItemViewHandler handler, ISwipeItemView view)
{
var swipeView = handler.PlatformView.GetParentOfType<MauiSwipeView>();
if (swipeView != null)
swipeView.UpdateIsVisibleSwipeItem(view);
swipeView?.UpdateIsVisibleSwipeItem(view);

handler.PlatformView.UpdateVisibility(view.Visibility);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ void ShowPickerDialog(int hour, int minute)

void HidePickerDialog()
{
if (_dialog != null)
{
_dialog.Hide();
}
_dialog?.Hide();

_dialog = null;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Handlers/Window/WindowHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public static void MapContent(IWindowHandler handler, IWindow window)
container.AddPage(windowManager.RootView);
}

if (window.VisualDiagnosticsOverlay != null)
window.VisualDiagnosticsOverlay.Initialize();
window.VisualDiagnosticsOverlay?.Initialize();
}

public static void MapX(IWindowHandler handler, IWindow view) =>
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Handlers/Window/WindowHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public static void MapContent(IWindowHandler handler, IWindow window)

handler.PlatformView.RootViewController = nativeContent;

if (window.VisualDiagnosticsOverlay != null)
window.VisualDiagnosticsOverlay.Initialize();
window.VisualDiagnosticsOverlay?.Initialize();
}

public static void MapX(IWindowHandler handler, IWindow view) =>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/MauiContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static void InitializeAppServices(this MauiApp mauiApp)
var initServices = mauiApp.Services.GetServices<IMauiInitializeService>();
if (initServices is null)
return;

foreach (var instance in initServices)
instance.Initialize(mauiApp.Services);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Platform/Android/MauiScrollView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public void SetOrientation(ScrollOrientation orientation)
if (_content != null && _content.Parent != this)
{
_content.RemoveFromParent();
if (_hScrollView != null)
_hScrollView.RemoveFromParent();
_hScrollView?.RemoveFromParent();
AddView(_content);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Platform/Android/MauiSearchView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ void Initialize()
{
var image = FindViewById<ImageView>(searchCloseButtonIdentifier);

if (image != null)
image.SetMinimumWidth((int?)Context?.ToPixels(44) ?? 0);
image?.SetMinimumWidth((int?)Context?.ToPixels(44) ?? 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Platform/Android/MauiWebViewClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public override void OnPageFinished(WebView? view, string? url)

handler.SyncPlatformCookiesToVirtualView(url);

if (handler != null)
handler.PlatformView.UpdateCanGoBackForward(handler.VirtualView);
handler?.PlatformView.UpdateCanGoBackForward(handler.VirtualView);

base.OnPageFinished(view, url);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Android/ScrollViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static void HandleScrollBarVisibilityChange(this IScrollBarView scrollV

public static void UpdateContent(this MauiScrollView scrollView, IView? content, IMauiContext context)
{
var nativeContent = content == null ? null : content.ToPlatform(context);
var nativeContent = content?.ToPlatform(context);

scrollView.RemoveAllViews();

Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Platform/Windows/BorderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public static void UpdateStrokeDashPattern(this Path borderPath, float[]? border
if (borderPath == null)
return;

if (borderPath.StrokeDashArray != null)
borderPath.StrokeDashArray.Clear();
borderPath.StrokeDashArray?.Clear();

if (borderDashArray != null && borderDashArray.Length > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Windows/ScrollViewerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void UpdateScrollBarVisibility(this ScrollViewer scrollViewer, Scr

public static void UpdateContent(this ScrollViewer scrollViewer, IView? content, IMauiContext context)
{
scrollViewer.Content = content == null ? null : content.ToPlatform(context);
scrollViewer.Content = content?.ToPlatform(context);
}
}
}
3 changes: 1 addition & 2 deletions src/Core/src/Platform/Windows/WindowRootView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ internal MauiToolbar? Toolbar
get => _toolbar;
set
{
if (_toolbar != null)
_toolbar.SetMenuBar(null);
_toolbar?.SetMenuBar(null);

_toolbar = value;
if (NavigationViewControl != null)
Expand Down
10 changes: 2 additions & 8 deletions src/Core/src/Platform/iOS/MauiSwipeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,15 +694,9 @@ void DisposeSwipeItems()
_swipeOffset = 0;
_originalBounds = CGRect.Empty;

if (_actionView != null)
{
_actionView.RemoveFromSuperview();
}
_actionView?.RemoveFromSuperview();

if (_swipeItemsRect != null)
{
_swipeItemsRect.Clear();
}
_swipeItemsRect?.Clear();

UpdateIsOpen(false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/iOS/ScrollViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void UpdateHorizontalScrollBarVisibility(this UIScrollView scrollV
// TODO ezhart This method is no longer used internally; we can't delete it right now because that'd be a breaking change
public static void UpdateContent(this UIScrollView scrollView, IView? content, IMauiContext context)
{
var nativeContent = content == null ? null : content.ToPlatform(context);
var nativeContent = content?.ToPlatform(context);

if (scrollView.Subviews.Length > 0 && scrollView.Subviews[0] == nativeContent)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ static Point GenerateAdornerOffset(View graphicsView)
var decorView = nativeActivity.Window?.DecorView;
var rectangle = new Android.Graphics.Rect();

if (decorView is not null)
{
decorView.GetWindowVisibleDisplayFrame(rectangle);
}
decorView?.GetWindowVisibleDisplayFrame(rectangle);

float dpi = nativeActivity.Resources.DisplayMetrics.Density;
return new Point(0, -(rectangle.Top / dpi));
Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/WindowOverlay/WindowOverlay.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ void DeinitializePlatformDependencies()
{
_graphicsView.Tapped -= ViewTapped;
_graphicsView.PointerMoved -= PointerMoved;
if (_panel != null)
_panel.RemoveOverlay(_graphicsView);
_panel?.RemoveOverlay(_graphicsView);
_graphicsView = null;
}
IsPlatformViewInitialized = false;
Expand Down
Loading