Browse Source

Remove callback on animation completion.

pull/1795/head
Jeremy Koritzinsky 8 years ago
parent
commit
8464a480e0
  1. 8
      src/Avalonia.Animation/Animation.cs

8
src/Avalonia.Animation/Animation.cs

@ -169,12 +169,18 @@ namespace Avalonia.Animation
if (this.RepeatCount == RepeatCount.Loop)
run.SetException(new InvalidOperationException("Looping animations must not use the Run method."));
this.Done += (sender, args) =>
EventHandler doneCallback = null;
doneCallback = (sender, args) =>
{
if (sender == control)
{
run.SetResult(null);
this.Done -= doneCallback;
}
};
this.Done += doneCallback;
this.Apply(control, Observable.Return(true));
return run.Task;

Loading…
Cancel
Save