Exemple #1
0
        private void SetStatus(string Text, Color Color, bool Temp = true)
        {
            if (StatusTimer != null && StatusTimer.IsEnabled)
            {
                StatusTimer.Stop();

                StatusText.Text      = Text;
                StatusBar.Background = new SolidColorBrush(Color);

                if (Temp)
                {
                    StatusTimer = new DispatcherTimer()
                    {
                        Interval = TimeSpan.FromSeconds(5)
                    };
                    StatusTimer.Tick += delegate
                    {
                        StatusBar.BeginAnimation(MarginProperty, new ThicknessAnimation()
                        {
                            From           = StatusBar.Margin,
                            To             = new Thickness(0, 0, 0, -30),
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseIn
                            }
                        });
                        StatusTimer.Stop();
                    };
                    StatusTimer.Start();
                }
            }
            else
            {
                StatusText.Text      = Text;
                StatusBar.Background = new SolidColorBrush(Color);

                if (Temp)
                {
                    StatusTimer = new DispatcherTimer()
                    {
                        Interval = TimeSpan.FromSeconds(5)
                    };
                    StatusTimer.Tick += delegate
                    {
                        StatusBar.BeginAnimation(MarginProperty, new ThicknessAnimation()
                        {
                            From           = StatusBar.Margin,
                            To             = new Thickness(0, 0, 0, -30),
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseIn
                            }
                        });
                        StatusTimer.Stop();
                    };
                }

                if (StatusBar.Margin.Bottom > -30)
                {
                    return;
                }
                var Animation = new ThicknessAnimation()
                {
                    From           = StatusBar.Margin,
                    To             = new Thickness(0, 0, 0, 0),
                    Duration       = TimeSpan.FromSeconds(0.5),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseOut
                    }
                };
                if (Temp)
                {
                    Animation.Completed += delegate { StatusTimer.Start(); }
                }
                ;
                StatusBar.BeginAnimation(MarginProperty, Animation);
            }
        }
Exemple #2
0
        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();
        }