Ejemplo n.º 1
0
        private void ConfigureAnimations(double width)
        {
            var textStoryboard = AnimationUtil.CreateDoubleStoryboard(_jumboTextGrid, 40, width, 0);

            textStoryboard.Completed += (s, e) =>
            {
                _dismissTimer.Start();
            };

            // The background will appear first, then the text
            _showStoryboard = AnimationUtil.CreateDoubleStoryboard(_jumboNotificationGrid, 75, width, 0);
            // Add a small delay to make the background and the text show up at different times
            _showStoryboard.Duration   = new Duration(TimeSpan.FromMilliseconds(250));
            _showStoryboard.Completed += (s, e) =>
            {
                textStoryboard.Begin();
                ViewModel.TextVisible = true;
            };

            var dismissGrid = AnimationUtil.CreateDoubleStoryboard(_jumboNotificationGrid, 40, 0, -width);

            dismissGrid.Completed += (s, e) =>
            {
                _currentJumboNotification?.SetResult(true);
                _currentJumboNotification = null;

                ViewModel.GridVisible = false;
                ViewModel.TextVisible = false;

                Debug.WriteLine("Jumbo notification dismissed.");
            };

            // The text will disappear first, then the background
            _dismissStoryboard            = AnimationUtil.CreateDoubleStoryboard(_jumboTextGrid, 40, 0, -width);
            _dismissStoryboard.Duration   = new Duration(TimeSpan.FromMilliseconds(250));
            _dismissStoryboard.Completed += (s, e) =>
            {
                dismissGrid.Begin();
            };
        }