diff --git a/src/Avalonia.Animation/Animation.cs b/src/Avalonia.Animation/Animation.cs index da4b3af38d..21b25d2515 100644 --- a/src/Avalonia.Animation/Animation.cs +++ b/src/Avalonia.Animation/Animation.cs @@ -162,27 +162,24 @@ namespace Avalonia.Animation } /// - public Task Run(Animatable control) + public Task RunAsync(Animatable control) { - var tcs = new TaskCompletionSource(); + var run = new TaskCompletionSource(); 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) diff --git a/src/Avalonia.Animation/IAnimation.cs b/src/Avalonia.Animation/IAnimation.cs index 7ceb6d5fe4..734eb3e479 100644 --- a/src/Avalonia.Animation/IAnimation.cs +++ b/src/Avalonia.Animation/IAnimation.cs @@ -18,6 +18,6 @@ namespace Avalonia.Animation /// /// Run the animation to the specified control /// - Task Run(Animatable control); + Task RunAsync(Animatable control); } } \ No newline at end of file