-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code Quality: Added StorageBar and StorageRing Controls (#16001)
- Loading branch information
Showing
22 changed files
with
3,491 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
64
src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
Oops, something went wrong.