public bool Equals(Slide other) { if (DurationInSeconds != other.DurationInSeconds) { return false; } if (BackgroundColour != other.BackgroundColour) { return false; } if (Widgets == null && other.Widgets == null) { return true; } if (Widgets == null && other.Widgets != null) { return false; } if (Widgets != null && other.Widgets == null) { return false; } if (Widgets.Count != other.Widgets.Count) { return false; } int i = 0; foreach (Widget widget in Widgets) { if (!widget.Equals(other.Widgets[i])) { return false; } i++; } return true; }
public void InitialiseSlide(Slide slide, TransitionType transitionType) { if (transitionType == TransitionType.None) { slide.Render(SlideshowGrid); return; } // fade out var duration = TimeSpan.FromMilliseconds(500); var fadeOutAnimation = new DoubleAnimation { From = 1.0, To = 0.0, Duration = new Duration(duration) }; var fadeOUtEasingFunction = new QuarticEase(); fadeOUtEasingFunction.EasingMode = EasingMode.EaseInOut; fadeOutAnimation.EasingFunction = fadeOUtEasingFunction; fadeOutAnimation.Completed += (sender, e) => { // fade in var fadeInAnimation = new DoubleAnimation { From = 0.0, To = 1.0, Duration = new Duration(duration) }; var fadeInEasingFunction = new QuarticEase(); fadeInEasingFunction.EasingMode = EasingMode.EaseInOut; fadeInAnimation.EasingFunction = fadeInEasingFunction; SlideshowGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation); slide.Render(SlideshowGrid); }; SlideshowGrid.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); }