Skip to content
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
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="ByteSize" Version="2.1.2" />
<PackageVersion Include="ColorCode.WinUI" Version="2.0.15" />
<PackageVersion Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" Version="0.1.250206-build.2040" />
<PackageVersion Include="CommunityToolkit.Labs.WinUI.DependencyPropertyGenerator" Version="0.1.250206-build.2040" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.250129-preview2" />
<PackageVersion Include="CommunityToolkit.WinUI.Controls.ColorPicker" Version="8.2.250129-preview2" />
Expand Down
1 change: 1 addition & 0 deletions src/Files.App.Controls/Files.App.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.DependencyPropertyGenerator" />
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<PackageReference Include="Microsoft.Windows.CsWinRT" />
Expand Down
61 changes: 42 additions & 19 deletions src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs
Original file line number Diff line number Diff line change
@@ -1,62 +1,85 @@
// Copyright (c) Files Community
// 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;

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)
[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double StartAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = 90.0d)]
public partial double EndAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = SweepDirection.Clockwise)]
public partial SweepDirection SweepDirection { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double MinAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = 360.0d)]
public partial double MaxAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double RadiusWidth { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double RadiusHeight { get; set; }

[GeneratedDependencyProperty]
public partial bool IsCircle { get; set; }

[GeneratedDependencyProperty]
public partial Point Center { get; set; }

[GeneratedDependencyProperty]
public partial double ActualRadiusWidth { get; set; }

[GeneratedDependencyProperty]
public partial double ActualRadiusHeight { get; set; }

partial void OnStartAngleChanged(double newValue)
{
StartAngleChanged();
}

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

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

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

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

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

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

protected virtual void OnIsCircleChanged(bool oldValue, bool newValue)
partial void OnIsCircleChanged(bool newValue)
{
IsCircleChanged();
}
Expand Down
37 changes: 25 additions & 12 deletions src/Files.App.Controls/Storage/StorageBar/StorageBar.Properties.cs
Original file line number Diff line number Diff line change
@@ -1,47 +1,60 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

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

namespace Files.App.Controls
{
[DependencyProperty<double>("ValueBarHeight", nameof(OnValueBarHeightChanged), DefaultValue = "(double)4.0")]
[DependencyProperty<double>("TrackBarHeight", nameof(OnTrackBarHeightChanged), DefaultValue = "(double)2.0")]
[DependencyProperty<BarShapes>("BarShape", nameof(OnBarShapeChanged), DefaultValue = "BarShapes.Round")]
[DependencyProperty<double>("Percent", nameof(OnPercentChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("PercentCaution", nameof(OnPercentCautionChanged), DefaultValue = "(double)75.1")]
[DependencyProperty<double>("PercentCritical", nameof(OnPercentCriticalChanged), DefaultValue = "(double)89.9")]
public partial class StorageBar
{
private void OnValueBarHeightChanged(double oldValue, double newValue)
[GeneratedDependencyProperty(DefaultValue = 4.0d)]
public partial double ValueBarHeight { get; set; }

[GeneratedDependencyProperty(DefaultValue = 2.0d)]
public partial double TrackBarHeight { get; set; }

[GeneratedDependencyProperty(DefaultValue = BarShapes.Round)]
public partial BarShapes BarShape { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double Percent { get; set; }

[GeneratedDependencyProperty(DefaultValue = 75.1d)]
public partial double PercentCaution { get; set; }

[GeneratedDependencyProperty(DefaultValue = 89.9d)]
public partial double PercentCritical { get; set; }

partial void OnValueBarHeightChanged(double newValue)
{
UpdateControl(this);
}

private void OnTrackBarHeightChanged(double oldValue, double newValue)
partial void OnTrackBarHeightChanged(double newValue)
{
UpdateControl(this);
}

private void OnBarShapeChanged(BarShapes oldValue, BarShapes newValue)
partial void OnBarShapeChanged(BarShapes newValue)
{
UpdateControl(this);
}

private void OnPercentChanged(double oldValue, double newValue)
partial void OnPercentChanged(double newValue)
{
return; //Read-only

DoubleToPercentage(Value, Minimum, Maximum);
UpdateControl(this);
}

private void OnPercentCautionChanged(double oldValue, double newValue)
partial void OnPercentCautionChanged(double newValue)
{
UpdateControl(this);
}

private void OnPercentCriticalChanged(double oldValue, double newValue)
partial void OnPercentCriticalChanged(double newValue)
{
UpdateControl(this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,57 +1,78 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

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

namespace Files.App.Controls
{
[DependencyProperty<double>("ValueRingThickness", nameof(OnValueRingThicknessChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("TrackRingThickness", nameof(OnTrackRingThicknessChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("MinAngle", nameof(OnMinAngleChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("MaxAngle", nameof(OnMaxAngleChanged), DefaultValue = "(double)360.0")]
[DependencyProperty<double>("StartAngle", nameof(OnStartAngleChanged), DefaultValue = "(double)0.0")]
[DependencyProperty<double>("Percent", nameof(OnPercentChanged))]
[DependencyProperty<double>("PercentCaution", nameof(OnPercentCautionChanged), DefaultValue = "(double)75.01")]
[DependencyProperty<double>("PercentCritical", nameof(OnPercentCriticalChanged), DefaultValue = "(double)90.01")]
[DependencyProperty<double>("ValueAngle")]
[DependencyProperty<double>("AdjustedSize", DefaultValue = "(double)16.0")]
public partial class StorageRing
{
private void OnValueRingThicknessChanged(double oldValue, double newValue)
[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double ValueRingThickness { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double TrackRingThickness { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double MinAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = 360.0d)]
public partial double MaxAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = 0.0d)]
public partial double StartAngle { get; set; }

[GeneratedDependencyProperty]
public partial double Percent { get; set; }

[GeneratedDependencyProperty(DefaultValue = 75.01d)]
public partial double PercentCaution { get; set; }

[GeneratedDependencyProperty(DefaultValue = 90.01d)]
public partial double PercentCritical { get; set; }

[GeneratedDependencyProperty]
public partial double ValueAngle { get; set; }

[GeneratedDependencyProperty(DefaultValue = 16.0d)]
public partial double AdjustedSize { get; set; }

partial void OnValueRingThicknessChanged(double newValue)
{
UpdateRingThickness(this, newValue, false);
UpdateRings(this);
}

private void OnTrackRingThicknessChanged(double oldValue, double newValue)
partial void OnTrackRingThicknessChanged(double newValue)
{
UpdateRingThickness(this, newValue, true);
UpdateRings(this);
}

private void OnMinAngleChanged(double oldValue, double newValue)
partial void OnMinAngleChanged(double newValue)
{
UpdateValues(this, Value, _oldValue, false, -1.0);
CalculateAndSetNormalizedAngles(this, newValue, MaxAngle);
UpdateRings(this);
}

private void OnMaxAngleChanged(double oldValue, double newValue)
partial void OnMaxAngleChanged(double newValue)
{
UpdateValues(this, Value, _oldValue, false, -1.0);
CalculateAndSetNormalizedAngles(this, MinAngle, newValue);
UpdateRings(this);
}

private void OnStartAngleChanged(double oldValue, double newValue)
partial void OnStartAngleChanged(double newValue)
{
UpdateValues(this, Value, _oldValue, false, -1.0);
CalculateAndSetNormalizedAngles(this, MinAngle, newValue);
ValidateStartAngle(this, newValue);
UpdateRings(this);
}

private void OnPercentChanged(double oldValue, double newValue)
partial void OnPercentChanged(double newValue)
{
return; //Read-only

Expand All @@ -71,14 +92,14 @@ private void OnPercentChanged(double oldValue, double newValue)
UpdateRings(this);
}

private void OnPercentCautionChanged(double oldValue, double newValue)
partial void OnPercentCautionChanged(double newValue)
{
UpdateValues(this, Value, _oldValue, false, -1.0);
UpdateVisualState(this);
UpdateRings(this);
}

private void OnPercentCriticalChanged(double oldValue, double newValue)
partial void OnPercentCriticalChanged(double newValue)
{
UpdateValues(this, Value, _oldValue, false, -1.0);
UpdateVisualState(this);
Expand Down
Loading
Loading