Skip to content

Code Quality: Ran code cleanup #17307

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

Merged
merged 3 commits into from
Jul 25, 2025
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Files.App.Controls
Expand Down Expand Up @@ -62,19 +57,19 @@
private static void OnOneRowModeEnabledChanged(DependencyObject d, object newValue)
{
var self = d as AdaptiveGridView;
self.DetermineOneRowMode();

Check warning on line 60 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Debug, arm64)

Dereference of a possibly null reference.

Check warning on line 60 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Release, x64)

Dereference of a possibly null reference.

Check warning on line 60 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Debug, x64)

Dereference of a possibly null reference.

Check warning on line 60 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Release, arm64)

Dereference of a possibly null reference.
}

private static void DesiredWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = d as AdaptiveGridView;
self.RecalculateLayout(self.ActualWidth);

Check warning on line 66 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Debug, arm64)

Dereference of a possibly null reference.

Check warning on line 66 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Release, x64)

Dereference of a possibly null reference.

Check warning on line 66 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Debug, x64)

Dereference of a possibly null reference.

Check warning on line 66 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Release, arm64)

Dereference of a possibly null reference.
}

private static void OnStretchContentForSingleRowPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = d as AdaptiveGridView;
self.RecalculateLayout(self.ActualWidth);

Check warning on line 72 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Debug, arm64)

Dereference of a possibly null reference.

Check warning on line 72 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Release, x64)

Dereference of a possibly null reference.

Check warning on line 72 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

View workflow job for this annotation

GitHub Actions / build (Debug, x64)

Dereference of a possibly null reference.
}

/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.UI.Xaml.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation.Collections;

namespace Files.App.Controls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.UI.Xaml.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Files.App.Controls
{
Expand Down
6 changes: 0 additions & 6 deletions src/Files.App.Controls/BladeView/BladeItem.Events.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Files.App.Controls
{
/// <summary>
Expand Down
7 changes: 1 addition & 6 deletions src/Files.App.Controls/BladeView/BladeItem.Properties.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.UI.Xaml.Media;
using Microsoft.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Media;

namespace Files.App.Controls
{
Expand Down
7 changes: 1 addition & 6 deletions src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Automation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Automation.Peers;

namespace Files.App.Controls
{
Expand All @@ -30,7 +25,7 @@

private BladeItem OwnerBladeItem
{
get { return this.Owner as BladeItem; }

Check warning on line 28 in src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs

View workflow job for this annotation

GitHub Actions / build (Debug, arm64)

Possible null reference return.
}

/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions src/Files.App.Controls/BladeView/BladeMode.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Files.App.Controls
{
/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions src/Files.App.Controls/BladeView/BladeView.Events.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Files.App.Controls
{
/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions src/Files.App.Controls/BladeView/BladeView.Properties.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;

namespace Files.App.Controls
Expand Down
5 changes: 0 additions & 5 deletions src/Files.App.Controls/BladeView/BladeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml.Automation.Peers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;

Expand Down
7 changes: 1 addition & 6 deletions src/Files.App.Controls/BladeView/BladeViewAutomationPeer.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Automation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Automation.Peers;

namespace Files.App.Controls
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override Size MeasureOverride(NonVirtualizingLayoutContext context, Si
if (context.Children[index] is BreadcrumbBarItem breadcrumbItem)
{
breadcrumbItem.Measure(availableSize);
accumulatedSize.Width += index < indexAfterEllipsis ? 0: breadcrumbItem.DesiredSize.Width;
accumulatedSize.Width += index < indexAfterEllipsis ? 0 : breadcrumbItem.DesiredSize.Width;
accumulatedSize.Height = Math.Max(accumulatedSize.Height, breadcrumbItem.DesiredSize.Height);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Input;

namespace Files.App.Controls
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App.Controls/SamplePanel/SamplePanel.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the MIT License.

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

namespace Files.App.Controls
{
Expand Down
4 changes: 0 additions & 4 deletions src/Files.App.Controls/SamplePanel/SamplePanel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;

namespace Files.App.Controls
{
// Visual states
Expand Down
1 change: 0 additions & 1 deletion src/Files.App.Controls/Sidebar/ISidebarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation;

Expand Down
4 changes: 2 additions & 2 deletions src/Files.App.Controls/Sidebar/SidebarItem.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public double ChildrenPresenterHeight
}
// Using 30 as a default in case something goes wrong
public static readonly DependencyProperty ChildrenPresenterHeightProperty =
DependencyProperty.Register(nameof(ChildrenPresenterHeight), typeof(double), typeof(SidebarItem), new PropertyMetadata(30d));
DependencyProperty.Register(nameof(ChildrenPresenterHeight), typeof(double), typeof(SidebarItem), new PropertyMetadata(30d));

public ISidebarItemModel? Item
{
Expand Down Expand Up @@ -112,7 +112,7 @@ public static void OnPropertyChanged(DependencyObject sender, DependencyProperty
{
item.UpdateExpansionState();
}
else if(e.Property == ItemProperty)
else if (e.Property == ItemProperty)
{
item.HandleItemChange();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Shapes;
using Windows.Foundation;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App.Controls/Storage/StorageBar/StorageBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private void UpdateColumnWidths()
true);

var interpolatedGapWidth = valueLarger
? StorageControlsHelpers.CalculateInterpolatedValue(
? StorageControlsHelpers.CalculateInterpolatedValue(
minPercent,
Percent,
minPercent + 2.0,
Expand Down
5 changes: 1 addition & 4 deletions src/Files.App.Controls/ThemedIcon/ThemedIcon.Consts.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

namespace Files.App.Controls
{
// Template Parts
Expand All @@ -12,7 +9,7 @@ namespace Files.App.Controls
[TemplatePart(Name = LayeredPathIconViewBox, Type = typeof(Viewbox))]
[TemplatePart(Name = LayeredPathCanvas, Type = typeof(Canvas))]
// Icon Type Visual States
[TemplateVisualState(Name = OutlineTypeStateName, GroupName = IconTypeStateGroupName)]
[TemplateVisualState(Name = OutlineTypeStateName, GroupName = IconTypeStateGroupName)]
[TemplateVisualState(Name = LayeredTypeStateName, GroupName = IconTypeStateGroupName)]
[TemplateVisualState(Name = FilledTypeStateName, GroupName = IconTypeStateGroupName)]
// Icon Color Visual States
Expand Down
3 changes: 0 additions & 3 deletions src/Files.App.Controls/ThemedIcon/ThemedIcon.Owner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Licensed under the MIT License.

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;

namespace Files.App.Controls
{
Expand Down
1 change: 0 additions & 1 deletion src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;

namespace Files.App.Controls
Expand Down
32 changes: 14 additions & 18 deletions src/Files.App.Controls/ThemedIcon/ThemedIcon.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Shapes;
using System.Linq;
using System.Collections.Generic;

namespace Files.App.Controls
{
/// <summary>
/// A control for a State and Color aware Icon
/// </summary>
public partial class ThemedIcon : Control
{
private Viewbox? _filledViewBox;
private Viewbox? _outlineViewBox;
private Viewbox? _layeredViewBox;
private Canvas? _layeredCanvas;
{
private Viewbox? _filledViewBox;
private Viewbox? _outlineViewBox;
private Viewbox? _layeredViewBox;
private Canvas? _layeredCanvas;

public ThemedIcon()
{
Expand Down Expand Up @@ -49,11 +45,11 @@ protected override void OnApplyTemplate()
private void GetTemplateParts()
{
// Gets the template parts and sets the private fields
_outlineViewBox = GetTemplateChild( OutlinePathIconViewBox ) as Viewbox;
_filledViewBox = GetTemplateChild( FilledPathIconViewBox ) as Viewbox;
_layeredViewBox = GetTemplateChild( LayeredPathIconViewBox ) as Viewbox;
_outlineViewBox = GetTemplateChild(OutlinePathIconViewBox) as Viewbox;
_filledViewBox = GetTemplateChild(FilledPathIconViewBox) as Viewbox;
_layeredViewBox = GetTemplateChild(LayeredPathIconViewBox) as Viewbox;

_layeredCanvas = GetTemplateChild( LayeredPathCanvas ) as Canvas;
_layeredCanvas = GetTemplateChild(LayeredPathCanvas) as Canvas;
}

// Updates paths and layers
Expand All @@ -64,7 +60,7 @@ private void OnFilledIconChanged()
if (_filledViewBox == null)
return;

SetPathData(FilledIconPath, FilledIconData ?? string.Empty, _filledViewBox );
SetPathData(FilledIconPath, FilledIconData ?? string.Empty, _filledViewBox);
}

private void OnOutlineIconChanged()
Expand All @@ -73,16 +69,16 @@ private void OnOutlineIconChanged()
if (_outlineViewBox == null)
return;

SetPathData(OutlineIconPath, OutlineIconData ?? string.Empty, _outlineViewBox );
SetPathData(OutlineIconPath, OutlineIconData ?? string.Empty, _outlineViewBox);
}

private void OnLayeredIconChanged()
{
// Updates Layered Icon from it's Layers
if ( _layeredViewBox == null ||
if (_layeredViewBox == null ||
_layeredCanvas == null ||
Layers is not ICollection<ThemedIconLayer> layers)
return;
return;

_layeredCanvas.Children.Clear();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Shapes;

namespace Files.App.Controls
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Shapes;
Expand Down Expand Up @@ -68,8 +66,8 @@ private void UpdateIconLayerState()
IconColorType switch
{
ThemedIconColorType.Critical => CriticalStateName,
ThemedIconColorType.Caution => CautionStateName,
ThemedIconColorType.Success => SuccessStateName,
ThemedIconColorType.Caution => CautionStateName,
ThemedIconColorType.Success => SuccessStateName,
ThemedIconColorType.Neutral => NeutralStateName,
ThemedIconColorType.Custom => CustomColorStateName,
_ => AccentStateName,
Expand Down
Loading
Loading