private void FadeOutEffect() { Action onFadeEnded; if (CurrentEffect == null || CurrentEffect.Next == null) { onFadeEnded = RemoveEffect; } else { var next = CurrentEffect.Next; var delay = CurrentEffect.Delay; onFadeEnded = delegate { RemoveEffect(); PlayEffect(next, delay); }; } var animation = new FadeAnimation(this, 0, CurrentEffect.FadeDuration, onFadeEnded); IsFading = true; EffectPanel.BeginAnimation(Panel.OpacityProperty, animation); }
private void FadeInEffect(double duration) { var animation = new FadeAnimation(this, 1, duration, delegate { IsFading = false; }); IsFading = true; EffectPanel.BeginAnimation(Panel.OpacityProperty, animation); }