Skip to content

Commit 08ab494

Browse files
authored
Code Quality: Added StorageBar and StorageRing Controls (#16001)
1 parent ef55240 commit 08ab494

22 files changed

+3491
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Controls
5+
{
6+
/// <summary>
7+
/// Defines BarShape for <see cref="StorageBar"/>.
8+
/// </summary>
9+
public enum BarShapes
10+
{
11+
/// <summary>
12+
/// The BarShape for Round StorageBars. Default state.
13+
/// </summary>
14+
Round,
15+
16+
/// <summary>
17+
/// The BarShape for Soft StorageBars.
18+
/// </summary>
19+
Soft,
20+
21+
/// <summary>
22+
/// The BarShape for Flat StorageBars.
23+
/// </summary>
24+
Flat,
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Controls
5+
{
6+
/// <summary>
7+
/// Defines ThicknessCheck values for <see cref="StorageRing"/> and <see cref="StorageBar"/>.
8+
/// </summary>
9+
public enum ThicknessCheck
10+
{
11+
/// <summary>
12+
/// The ThicknessCheck for when the Value Thickness is thickest.
13+
/// </summary>
14+
Value,
15+
16+
/// <summary>
17+
/// The ThicknessCheck for when the Track Thickness is thickest.
18+
/// </summary>
19+
Track,
20+
21+
/// <summary>
22+
/// The ThicknessCheck for when the both Value and Track
23+
/// Thickness is equal.
24+
/// </summary>
25+
Equal,
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
using Microsoft.UI.Xaml;
5+
using Microsoft.UI.Xaml.Media;
6+
using Microsoft.UI.Xaml.Shapes;
7+
using Windows.Foundation;
8+
9+
namespace Files.App.Controls.Primitives
10+
{
11+
[DependencyProperty<double>("StartAngle", nameof(OnStartAngleChanged), DefaultValue = "(double)0.0")]
12+
[DependencyProperty<double>("EndAngle", nameof(OnEndAngleChanged), DefaultValue = "(double)90.0")]
13+
[DependencyProperty<SweepDirection>("SweepDirection", nameof(OnSweepDirectionChanged), DefaultValue = "global::Microsoft.UI.Xaml.Media.SweepDirection.Clockwise")]
14+
[DependencyProperty<double>("MinAngle", nameof(OnMinAngleChanged), DefaultValue = "(double)0.0")]
15+
[DependencyProperty<double>("MaxAngle", nameof(OnMaxAngleChanged), DefaultValue = "(double)360.0")]
16+
[DependencyProperty<double>("RadiusWidth", nameof(OnRadiusWidthChanged), DefaultValue = "(double)0.0")]
17+
[DependencyProperty<double>("RadiusHeight", nameof(OnRadiusHeightChanged), DefaultValue = "(double)0.0")]
18+
[DependencyProperty<bool>("IsCircle", nameof(OnIsCircleChanged), DefaultValue = "(bool)false")]
19+
[DependencyProperty<Point>("Center")]
20+
[DependencyProperty<double>("ActualRadiusWidth")]
21+
[DependencyProperty<double>("ActualRadiusHeight")]
22+
public partial class RingShape : Path
23+
{
24+
protected virtual void OnStartAngleChanged(double oldValue, double newValue)
25+
{
26+
StartAngleChanged();
27+
}
28+
29+
protected virtual void OnEndAngleChanged(double oldValue, double newValue)
30+
{
31+
EndAngleChanged();
32+
}
33+
34+
protected virtual void OnSweepDirectionChanged(SweepDirection oldValue, SweepDirection newValue)
35+
{
36+
SweepDirectionChanged();
37+
}
38+
39+
protected virtual void OnMinAngleChanged(double oldValue, double newValue)
40+
{
41+
MinMaxAngleChanged(false);
42+
}
43+
44+
protected virtual void OnMaxAngleChanged(double oldValue, double newValue)
45+
{
46+
MinMaxAngleChanged(true);
47+
}
48+
49+
protected virtual void OnRadiusWidthChanged(double oldValue, double newValue)
50+
{
51+
RadiusWidthChanged();
52+
}
53+
54+
protected virtual void OnRadiusHeightChanged(double oldValue, double newValue)
55+
{
56+
RadiusHeightChanged();
57+
}
58+
59+
protected virtual void OnIsCircleChanged(bool oldValue, bool newValue)
60+
{
61+
IsCircleChanged();
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)