Skip to content

Code Quality: Added StorageBar and StorageRing Controls #16001

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 6 commits into from
Nov 25, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading