public void PageEnter() { DispatcherTimer Timer = new DispatcherTimer(); Timer.Interval = TimeSpan.FromSeconds(0.25); int Count = 0; Timer.Tick += delegate { switch (Count) { case 0: AvatorEllipse.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); break; case 1: NameLabel.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); NameBox.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); break; case 2: DescriptionLabel.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); DescriptionBox.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); break; case 3: BackButton.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); SignupButton.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); break; } Count++; if (Count >= 4) { Timer.Stop(); } }; Timer.Start(); }
public void PageLeave() { DispatcherTimer Timer = new DispatcherTimer(); Timer.Interval = TimeSpan.FromSeconds(0.5); Timer.Tick += delegate { LeaveAction?.Invoke(); Timer.Stop(); }; AvatorEllipse.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = AvatorEllipse.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); MaskEllipse.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = MaskEllipse.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); NameLabel.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = NameLabel.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); NameBox.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = NameBox.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); DescriptionLabel.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = DescriptionLabel.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); DescriptionBox.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = DescriptionBox.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); BackButton.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = BackButton.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); SignupButton.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = SignupButton.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); StatusBar.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = StatusBar.Opacity, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, }); Timer.Start(); }