Browse Source
Change Run to RunAsync for convention's sake.
pull/1795/head
Jumar Macato
8 years ago
No known key found for this signature in database
GPG Key ID: B19884DAC3A5BF3F
2 changed files with
7 additions and
10 deletions
-
src/Avalonia.Animation/Animation.cs
-
src/Avalonia.Animation/IAnimation.cs
|
|
|
@ -162,27 +162,24 @@ namespace Avalonia.Animation |
|
|
|
} |
|
|
|
|
|
|
|
/// <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) |
|
|
|
{ |
|
|
|
tcs.SetException(new InvalidOperationException("Looping animations must not use the Run method.")); |
|
|
|
return tcs.Task; |
|
|
|
} |
|
|
|
run.SetException(new InvalidOperationException("Looping animations must not use the Run method.")); |
|
|
|
|
|
|
|
this.Done += (sender, args) => |
|
|
|
{ |
|
|
|
if (sender == control) |
|
|
|
tcs.SetResult(null); |
|
|
|
run.SetResult(null); |
|
|
|
else |
|
|
|
tcs.SetCanceled(); |
|
|
|
run.SetCanceled(); |
|
|
|
}; |
|
|
|
|
|
|
|
this.Apply(control, Observable.Return(true)); |
|
|
|
|
|
|
|
return tcs.Task; |
|
|
|
return run.Task; |
|
|
|
} |
|
|
|
|
|
|
|
internal void SetDone(Animatable control) |
|
|
|
|
|
|
|
@ -18,6 +18,6 @@ namespace Avalonia.Animation |
|
|
|
/// <summary>
|
|
|
|
/// Run the animation to the specified control
|
|
|
|
/// </summary>
|
|
|
|
Task Run(Animatable control); |
|
|
|
Task RunAsync(Animatable control); |
|
|
|
} |
|
|
|
} |