Skip to content

Commit

Permalink
ci(progressbar): Applied CI review
Browse files Browse the repository at this point in the history
  • Loading branch information
carldebilly committed Jun 16, 2020
1 parent 99ee738 commit 33ea0b9
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 13 deletions.
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

Expand All @@ -13,7 +14,7 @@ public object Convert(object value, Type targetType, object parameter, string la
return thickness;
}

var doubleValue = System.Convert.ToDouble(value);
var doubleValue = System.Convert.ToDouble(value, NumberFormatInfo.InvariantInfo);
return new Thickness(doubleValue);
}

Expand Down
@@ -1,6 +1,6 @@
namespace Windows.UI.Xaml.Media.Animation {
export class RenderingLoopFloatAnimator {
static activeInstances: { [jsHandle: number]: RenderingLoopFloatAnimator} = {};
private static activeInstances: { [jsHandle: number]: RenderingLoopFloatAnimator} = {};

public static createInstance(managedHandle: string, jsHandle: number) {
RenderingLoopFloatAnimator.activeInstances[jsHandle] = new RenderingLoopFloatAnimator(managedHandle);
Expand Down
Expand Up @@ -145,10 +145,15 @@ void ITimeline.Seek(TimeSpan offset)

if (targetAnimator != _currentAnimator)
{
_currentAnimator.Cancel();
_currentAnimator?.Cancel();
_currentAnimator = targetAnimator;
}

if(_currentAnimator == null)
{
return;
}

_currentAnimator.CurrentPlayTime = (long)offset.TotalMilliseconds; //Offset is CurrentPlayTime (starting point for animation)

if (State == TimelineState.Active || State == TimelineState.Paused)
Expand Down
6 changes: 3 additions & 3 deletions src/Uno.UI/UI/Xaml/Media/Animation/ColorKeyFrame.cs
Expand Up @@ -6,13 +6,13 @@ namespace Windows.UI.Xaml.Media.Animation
{
public abstract partial class ColorKeyFrame : DependencyObject
{
public ColorKeyFrame()
protected ColorKeyFrame()
{
IsAutoPropertyInheritanceEnabled = true;
InitializeBinder();
}

public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
public static DependencyProperty ValueProperty { get; } = DependencyProperty.Register(
"Value",
typeof(Color),
typeof(ColorKeyFrame),
Expand All @@ -24,7 +24,7 @@ public Color Value
set => SetValue(ValueProperty, value);
}

public static readonly DependencyProperty KeyTimeProperty = DependencyProperty.Register(
public static DependencyProperty KeyTimeProperty { get; } = DependencyProperty.Register(
"KeyTime",
typeof(KeyTime),
typeof(ColorKeyFrame),
Expand Down
36 changes: 35 additions & 1 deletion src/Uno.UI/UI/Xaml/Media/Animation/ColorKeyFrameCollection.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;

namespace Windows.UI.Xaml.Media.Animation
{
Expand All @@ -11,5 +12,38 @@ public ColorKeyFrameCollection() : base(null, false)
internal ColorKeyFrameCollection(DependencyObject owner, bool isAutoPropertyInheritanceEnabled) : base(owner, isAutoPropertyInheritanceEnabled)
{
}

public new uint Size => base.Size;

public new IEnumerator<ColorKeyFrame> GetEnumerator() => base.GetEnumerator();

public new void Add(ColorKeyFrame item) => base.Add(item);

public new void Clear() => base.Clear();

public new bool Contains(ColorKeyFrame item) => base.Contains(item);

public new void CopyTo(ColorKeyFrame[] array, int arrayIndex) => base.CopyTo(array, arrayIndex);

public new bool Remove(ColorKeyFrame item) => base.Remove(item);

public new int Count => base.Count;
public new bool IsReadOnly
{
get => base.IsReadOnly;
set => throw new NotSupportedException();
}

public new int IndexOf(ColorKeyFrame item) => base.IndexOf(item);

public new void Insert(int index, ColorKeyFrame item) => base.Insert(index, item);

public new void RemoveAt(int index) => base.RemoveAt(index);

public new ColorKeyFrame this[int index]
{
get => base[index];
set => base[index] = value;
}
}
}
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Media/Animation/EasingColorKeyFrame.cs
Expand Up @@ -2,7 +2,7 @@
{
partial class EasingColorKeyFrame : ColorKeyFrame
{
public static DependencyProperty EasingFunctionProperty = DependencyProperty.Register(
public static DependencyProperty EasingFunctionProperty { get; } = DependencyProperty.Register(
"EasingFunction", typeof(EasingFunctionBase),
typeof(EasingColorKeyFrame),
new FrameworkPropertyMetadata(default(EasingFunctionBase)));
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Media/Animation/FadeInThemeAnimation.cs
Expand Up @@ -25,7 +25,7 @@ public FadeInThemeAnimation()
DependencyPropertyValuePrecedences.DefaultValue);
}

public static readonly DependencyProperty TargetNameProperty = DependencyProperty.Register(
public static DependencyProperty TargetNameProperty { get; } = DependencyProperty.Register(
"TargetName", typeof(string), typeof(FadeInThemeAnimation), new PropertyMetadata(null));

public string TargetName
Expand Down
Expand Up @@ -25,7 +25,7 @@ public FadeOutThemeAnimation()
DependencyPropertyValuePrecedences.DefaultValue);
}

public static readonly DependencyProperty TargetNameProperty = DependencyProperty.Register(
public static DependencyProperty TargetNameProperty { get; } = DependencyProperty.Register(
"TargetName", typeof(string), typeof(FadeOutThemeAnimation), new PropertyMetadata(null));

public string TargetName
Expand Down
5 changes: 5 additions & 0 deletions src/Uno.UI/UI/Xaml/Media/Animation/KeyTime.cs
Expand Up @@ -68,5 +68,10 @@ public override string ToString()
}

int IComparable<KeyTime>.CompareTo(KeyTime other) => TimeSpan.CompareTo(other.TimeSpan);

public static bool operator <(KeyTime keytime1, KeyTime keytime2) => keytime1.TimeSpan < keytime2.TimeSpan;
public static bool operator >(KeyTime keytime1, KeyTime keytime2) => keytime1.TimeSpan > keytime2.TimeSpan;
public static bool operator <=(KeyTime keytime1, KeyTime keytime2) => keytime1.TimeSpan <= keytime2.TimeSpan;
public static bool operator >=(KeyTime keytime1, KeyTime keytime2) => keytime1.TimeSpan >= keytime2.TimeSpan;
}
}
Expand Up @@ -53,7 +53,7 @@ public ObjectKeyFrameCollection KeyFrames
/// This property is not exposed as a DP in UWP, but it is required
/// to be one for the DataContext/TemplatedParent to flow properly.
/// </remarks>
internal static readonly DependencyProperty KeyFramesProperty =
internal static DependencyProperty KeyFramesProperty { get; } =
DependencyProperty.Register(
name: "KeyFrames",
propertyType: typeof(ObjectKeyFrameCollection),
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Media/SolidColorBrush.cs
Expand Up @@ -127,6 +127,6 @@ public bool Equals(SolidColorBrush other)

public static bool operator !=(SolidColorBrush left, SolidColorBrush right) => !Equals(left, right);

public static explicit operator Color(SolidColorBrush scb) => scb.Color;
public static explicit operator Color(SolidColorBrush scb) => scb?.Color ?? default;
}
}
2 changes: 1 addition & 1 deletion src/Uno.UWP/UI/ColorOffset.cs
Expand Up @@ -27,7 +27,7 @@ private ColorOffset(int a, int r, int g, int b)
B = b;
}

public static ColorOffset Zero = default;
public static readonly ColorOffset Zero = default;

public static ColorOffset FromArgb(int a, int r, int g, int b) => new ColorOffset(a, r, g, b);

Expand Down

0 comments on commit 33ea0b9

Please sign in to comment.