Exemple #1
0
        protected void OnWindowClosing(IViewLifetimeContext viewLifetimeContext)
        {
            // Call NavigatingFrom(...) methods

            if (viewLifetimeContext.View is INavigationAware)
                ((INavigationAware)viewLifetimeContext.View).NavigatingFrom(NavigationMode.Back);

            if (viewLifetimeContext.ViewModel is INavigationAware)
                ((INavigationAware)viewLifetimeContext.ViewModel).NavigatingFrom(NavigationMode.Back);

            // Dispose of the view lifetime context

            viewLifetimeContext.Dispose();
        }
        protected void OnWindowClosing(IViewLifetimeContext viewLifetimeContext)
        {
            if (viewLifetimeContext == null)
                throw new ArgumentNullException(nameof(viewLifetimeContext));

            // Call NavigatingFrom(...) methods

            if (viewLifetimeContext.View is INavigationAware)
                ((INavigationAware)viewLifetimeContext.View).NavigatingFrom(PageNavigationMode.Back);

            if (viewLifetimeContext.ViewModel is INavigationAware)
                ((INavigationAware)viewLifetimeContext.ViewModel).NavigatingFrom(PageNavigationMode.Back);

            // Dispose of the view lifetime context

            viewLifetimeContext.Dispose();
        }