Skip to content

Commit

Permalink
Code Quality: Added StorageBar and StorageRing Controls (#16001)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtauk authored Nov 25, 2024
1 parent ef55240 commit 08ab494
Show file tree
Hide file tree
Showing 22 changed files with 3,491 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/Files.App.Controls/Storage/Data/BarShapes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Controls
{
/// <summary>
/// Defines BarShape for <see cref="StorageBar"/>.
/// </summary>
public enum BarShapes
{
/// <summary>
/// The BarShape for Round StorageBars. Default state.
/// </summary>
Round,

/// <summary>
/// The BarShape for Soft StorageBars.
/// </summary>
Soft,

/// <summary>
/// The BarShape for Flat StorageBars.
/// </summary>
Flat,
}
}
27 changes: 27 additions & 0 deletions src/Files.App.Controls/Storage/Data/ThicknessCheck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Controls
{
/// <summary>
/// Defines ThicknessCheck values for <see cref="StorageRing"/> and <see cref="StorageBar"/>.
/// </summary>
public enum ThicknessCheck
{
/// <summary>
/// The ThicknessCheck for when the Value Thickness is thickest.
/// </summary>
Value,

/// <summary>
/// The ThicknessCheck for when the Track Thickness is thickest.
/// </summary>
Track,

/// <summary>
/// The ThicknessCheck for when the both Value and Track
/// Thickness is equal.
/// </summary>
Equal,
}
}
64 changes: 64 additions & 0 deletions src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Shapes;
using Windows.Foundation;

namespace Files.App.Controls.Primitives
{
[DependencyProperty<double>("StartAngle", nameof(OnStartAngleChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("EndAngle", nameof(OnEndAngleChanged), DefaultValue = "(double)90.0")]
[DependencyProperty<SweepDirection>("SweepDirection", nameof(OnSweepDirectionChanged), DefaultValue = "global::Microsoft.UI.Xaml.Media.SweepDirection.Clockwise")]
[DependencyProperty<double>("MinAngle", nameof(OnMinAngleChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("MaxAngle", nameof(OnMaxAngleChanged), DefaultValue = "(double)360.0")]
[DependencyProperty<double>("RadiusWidth", nameof(OnRadiusWidthChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("RadiusHeight", nameof(OnRadiusHeightChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<bool>("IsCircle", nameof(OnIsCircleChanged), DefaultValue = "(bool)false")]
[DependencyProperty<Point>("Center")]
[DependencyProperty<double>("ActualRadiusWidth")]
[DependencyProperty<double>("ActualRadiusHeight")]
public partial class RingShape : Path
{
protected virtual void OnStartAngleChanged(double oldValue, double newValue)
{
StartAngleChanged();
}

protected virtual void OnEndAngleChanged(double oldValue, double newValue)
{
EndAngleChanged();
}

protected virtual void OnSweepDirectionChanged(SweepDirection oldValue, SweepDirection newValue)
{
SweepDirectionChanged();
}

protected virtual void OnMinAngleChanged(double oldValue, double newValue)
{
MinMaxAngleChanged(false);
}

protected virtual void OnMaxAngleChanged(double oldValue, double newValue)
{
MinMaxAngleChanged(true);
}

protected virtual void OnRadiusWidthChanged(double oldValue, double newValue)
{
RadiusWidthChanged();
}

protected virtual void OnRadiusHeightChanged(double oldValue, double newValue)
{
RadiusHeightChanged();
}

protected virtual void OnIsCircleChanged(bool oldValue, bool newValue)
{
IsCircleChanged();
}
}
}
Loading

0 comments on commit 08ab494

Please sign in to comment.