private void CustomConnectedAnimationDetail_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (!e.Handled)
            {
                // Unregister the handler
                SystemNavigationManager.GetForCurrentView().BackRequested -= CustomConnectedAnimationDetail_BackRequested;

                // We are about to transition to a new page.  Cancel any outstanding transitions.
                if (_currentTransition != null)
                {
                    if (!_currentTransition.Completed)
                    {
                        _currentTransition.Cancel();
                    }
                    _currentTransition = null;
                }

                // Setup the new transition and trigger the navigation
                ConnectedTransition transition = new ConnectedTransition();
                transition.Initialize(_host, ThumbnailImage, _detailsInfo);

                _host.Navigate(typeof(CustomConnectedAnimation), transition);

                // We've got it handled
                e.Handled = true;
            }
        }
        private void ThumbnailList_Click(object sender, ItemClickEventArgs e)
        {
            GridView gridView = (GridView)sender;
            GridViewItem item = (GridViewItem)gridView.ContainerFromItem(e.ClickedItem);
            CompositionImage image = VisualTreeHelperExtensions.GetFirstDescendantOfType<CompositionImage>(item);

            // We are about to transition to a new page.  Cancel any outstanding transitions.
            if (_currentTransition != null)
            {
                if (!_currentTransition.Completed)
                {
                    _currentTransition.Cancel();
                }
                _currentTransition = null;
            }

            DetailsInfo info;
            info.thumbanil = (Thumbnail)e.ClickedItem;

            // Setup the new transition and trigger the navigation
            ConnectedTransition transition = new ConnectedTransition();
            transition.Initialize(Frame, image, info);

            Frame.Navigate(typeof(CustomConnectedAnimationDetail), transition);
        }
        private void ThumbnailList_Click(object sender, ItemClickEventArgs e)
        {
            GridView         gridView = (GridView)sender;
            GridViewItem     item     = (GridViewItem)gridView.ContainerFromItem(e.ClickedItem);
            CompositionImage image    = VisualTreeHelperExtensions.GetFirstDescendantOfType <CompositionImage>(item);

            // We are about to transition to a new page.  Cancel any outstanding transitions.
            if (_currentTransition != null)
            {
                if (!_currentTransition.Completed)
                {
                    _currentTransition.Cancel();
                }
                _currentTransition = null;
            }

            DetailsInfo info;

            info.thumbanil = (Thumbnail)e.ClickedItem;

            // Setup the new transition and trigger the navigation
            ConnectedTransition transition = new ConnectedTransition();

            transition.Initialize(Frame, image, info);

            Frame.Navigate(typeof(CustomConnectedAnimationDetail), transition);
        }
Пример #4
0
        private void CustomConnectedAnimationDetail_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (!e.Handled)
            {
                // Unregister the handler
                SystemNavigationManager.GetForCurrentView().BackRequested -= CustomConnectedAnimationDetail_BackRequested;

                // We are about to transition to a new page.  Cancel any outstanding transitions.
                if (_currentTransition != null)
                {
                    if (!_currentTransition.Completed)
                    {
                        _currentTransition.Cancel();
                    }
                    _currentTransition = null;
                }

                // Setup the new transition and trigger the navigation
                ConnectedTransition transition = new ConnectedTransition();
                transition.Initialize(_host, ThumbnailImage, _detailsInfo);

                _host.Navigate(typeof(CustomConnectedAnimation), transition);

                // We've got it handled
                e.Handled = true;
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Store the incoming parameter
            if (e.Parameter is ConnectedTransition)
            {
                _currentTransition = (ConnectedTransition)e.Parameter;
            }

            //Hide the back button on the list page as there is no where to go back to.
            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Collapsed;
        }
Пример #6
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            _currentTransition = (ConnectedTransition)e.Parameter;
            _detailsInfo       = (CustomConnectedAnimation.DetailsInfo)_currentTransition.Payload;
            _host = _currentTransition.Host as Frame;

            Title.Text      = _detailsInfo.thumbanil.Name;
            DetailText.Text = _detailsInfo.thumbanil.Description;

            // Enable the back button
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = _host.CanGoBack ?
                                                                                      AppViewBackButtonVisibility.Visible :
                                                                                      AppViewBackButtonVisibility.Collapsed;

            SystemNavigationManager.GetForCurrentView().BackRequested += CustomConnectedAnimationDetail_BackRequested;
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            _currentTransition = (ConnectedTransition)e.Parameter;
            _detailsInfo = (CustomConnectedAnimation.DetailsInfo)_currentTransition.Payload;
            _host = _currentTransition.Host as Frame;

            Title.Text = _detailsInfo.thumbanil.Name;
            DetailText.Text = _detailsInfo.thumbanil.Description;

            // Enable the back button
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = _host.CanGoBack ?
                                                AppViewBackButtonVisibility.Visible : 
                                                AppViewBackButtonVisibility.Collapsed;
            
            SystemNavigationManager.GetForCurrentView().BackRequested += CustomConnectedAnimationDetail_BackRequested;
        }
Пример #8
0
        /// <summary>
        /// Private constructor as Show() is responsible for creating an instance
        /// </summary>
        private ImagePopupViewer(Func <object, bool, Uri> photoGetter, string initialPhoto)
        {
            this.InitializeComponent();

            _imageUriGetterFunc = photoGetter;
            _transition         = new ConnectedTransition();
            _compositor         = ElementCompositionPreview.GetElementVisual(this).Compositor;
            this.Loaded        += ImagePopupViewer_Loaded;
            this.Unloaded      += ImagePopupViewer_Unloaded;

            // Bring the selected item into view
            _initialPhoto = initialPhoto;

            // Hide until the content is available
            this.Opacity = 0;
            BackgroundImage.ImageOpened += BackgroundImage_FirstOpened;

            // Disable the placeholder as we'll be using a transition
            PrimaryImage.PlaceholderDelay         = TimeSpan.FromMilliseconds(-1);
            BackgroundImage.PlaceholderDelay      = TimeSpan.FromMilliseconds(-1);
            BackgroundImage.LoadTimeEffectHandler = SampleImageColor;
            BackgroundImage.SharedSurface         = true;

            // Create a crossfade brush to animate image transitions
            IGraphicsEffect graphicsEffect = new ArithmeticCompositeEffect()
            {
                Name           = "CrossFade",
                Source1Amount  = 0,
                Source2Amount  = 1,
                MultiplyAmount = 0,
                Source1        = new CompositionEffectSourceParameter("ImageSource"),
                Source2        = new CompositionEffectSourceParameter("ImageSource2"),
            };

            CompositionEffectFactory factory = _compositor.CreateEffectFactory(graphicsEffect, new[] { "CrossFade.Source1Amount", "CrossFade.Source2Amount" });

            _crossFadeBrush = factory.CreateBrush();
        }
        /// <summary>
        /// Private constructor as Show() is responsible for creating an instance
        /// </summary>
        private ImagePopupViewer(Func<object, bool, Uri> photoGetter, string initialPhoto)
        {
            this.InitializeComponent();

            _imageUriGetterFunc = photoGetter;
            _transition = new ConnectedTransition();
            _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
            this.Loaded += ImagePopupViewer_Loaded;
            this.Unloaded += ImagePopupViewer_Unloaded;

            // Bring the selected item into view
            _initialPhoto = initialPhoto;
            
            // Hide until the content is available
            this.Opacity = 0;
            BackgroundImage.ImageOpened += BackgroundImage_FirstOpened;

            // Disable the placeholder as we'll be using a transition
            PrimaryImage.PlaceholderDelay = TimeSpan.FromMilliseconds(-1);
            BackgroundImage.PlaceholderDelay = TimeSpan.FromMilliseconds(-1);
            BackgroundImage.LoadTimeEffectHandler = SampleImageColor;
            BackgroundImage.SharedSurface = true;

            // Create a crossfade brush to animate image transitions
            IGraphicsEffect graphicsEffect = new ArithmeticCompositeEffect()
            {
                Name = "CrossFade",
                Source1Amount = 0,
                Source2Amount = 1,
                MultiplyAmount = 0,
                Source1 = new CompositionEffectSourceParameter("ImageSource"),
                Source2 = new CompositionEffectSourceParameter("ImageSource2"),
            };

            CompositionEffectFactory factory = _compositor.CreateEffectFactory(graphicsEffect, new[] { "CrossFade.Source1Amount", "CrossFade.Source2Amount" });
            _crossFadeBrush = factory.CreateBrush();

        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Store the incoming parameter
            if (e.Parameter is ConnectedTransition)
            {
                _currentTransition = (ConnectedTransition)e.Parameter;
            }
            else
            {
                // Should not run ConnectedTransition
                _currentTransition = null;
            }

            //Hide the back button on the list page as there is no where to go back to. 
            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Collapsed;
        }