private RoutedEventHandler CurrentControlOnMediaOpened(MediaElement lastControl) { return delegate(object j, RoutedEventArgs y) { this.CurrentControl.Visibility = Visibility.Visible; DoubleAnimation animation = new DoubleAnimation(0.0, 1.0, new Duration(TimeSpan.FromMilliseconds(1300.0))); DoubleAnimation animation2 = new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromMilliseconds(1300.0))); animation.AutoReverse = false; animation2.AutoReverse = false; animation2.Completed += delegate(object f, EventArgs k) { lastControl.Stop(); lastControl.Visibility = Visibility.Hidden; }; animation.Completed += delegate(object f, EventArgs k) { lastControl.Stop(); lastControl.Visibility = Visibility.Hidden; }; lastControl.BeginAnimation(UIElement.OpacityProperty, animation2); this.CurrentControl.BeginAnimation(UIElement.OpacityProperty, animation); }; }