2023-09-29 17:02:19 +03:00
|
|
|
|
namespace Bit.App.Utilities
|
2023-01-20 16:38:31 +03:00
|
|
|
|
{
|
|
|
|
|
public static class ProgressBarExtensions
|
|
|
|
|
{
|
|
|
|
|
public static BindableProperty AnimatedProgressProperty =
|
|
|
|
|
BindableProperty.CreateAttached("AnimatedProgress",
|
|
|
|
|
typeof(double),
|
|
|
|
|
typeof(ProgressBar),
|
|
|
|
|
0.0d,
|
|
|
|
|
BindingMode.OneWay,
|
|
|
|
|
propertyChanged: (b, o, n) => ProgressBarProgressChanged((ProgressBar)b, (double)n));
|
|
|
|
|
|
|
|
|
|
public static double GetAnimatedProgress(BindableObject target) => (double)target.GetValue(AnimatedProgressProperty);
|
|
|
|
|
public static void SetAnimatedProgress(BindableObject target, double value) => target.SetValue(AnimatedProgressProperty, value);
|
|
|
|
|
|
|
|
|
|
private static void ProgressBarProgressChanged(ProgressBar progressBar, double progress)
|
|
|
|
|
{
|
2023-09-29 17:02:19 +03:00
|
|
|
|
Microsoft.Maui.Controls.ViewExtensions.CancelAnimations(progressBar);
|
2023-01-20 16:38:31 +03:00
|
|
|
|
progressBar.ProgressTo(progress, 500, Easing.SinIn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|