Browse Source

Change Run to RunAsync for convention's sake.

pull/1795/head
Jumar Macato 8 years ago
parent
commit
25808ea5d9
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 15
      src/Avalonia.Animation/Animation.cs
  2. 2
      src/Avalonia.Animation/IAnimation.cs

15
src/Avalonia.Animation/Animation.cs

@ -162,27 +162,24 @@ namespace Avalonia.Animation
} }
/// <inheritdocs/> /// <inheritdocs/>
public Task Run(Animatable control) public Task RunAsync(Animatable control)
{ {
var tcs = new TaskCompletionSource<object>(); var run = new TaskCompletionSource<object>();
if (this.RepeatCount == RepeatCount.Loop) if (this.RepeatCount == RepeatCount.Loop)
{ run.SetException(new InvalidOperationException("Looping animations must not use the Run method."));
tcs.SetException(new InvalidOperationException("Looping animations must not use the Run method."));
return tcs.Task;
}
this.Done += (sender, args) => this.Done += (sender, args) =>
{ {
if (sender == control) if (sender == control)
tcs.SetResult(null); run.SetResult(null);
else else
tcs.SetCanceled(); run.SetCanceled();
}; };
this.Apply(control, Observable.Return(true)); this.Apply(control, Observable.Return(true));
return tcs.Task; return run.Task;
} }
internal void SetDone(Animatable control) internal void SetDone(Animatable control)

2
src/Avalonia.Animation/IAnimation.cs

@ -18,6 +18,6 @@ namespace Avalonia.Animation
/// <summary> /// <summary>
/// Run the animation to the specified control /// Run the animation to the specified control
/// </summary> /// </summary>
Task Run(Animatable control); Task RunAsync(Animatable control);
} }
} }
Loading…
Cancel
Save