コード例 #1
0
        private void RefreshAppViewBackButtonVisibility(NavigationServiceBase sender)
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }

            if (((CrystalApplication)CrystalApplication.Current).Options.HandleBackButtonForTopLevelNavigation)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    sender.CanGoBackward ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
            }
        }
コード例 #2
0
        /// <summary>
        /// Registers the NavigationService with the NavigationManager.
        /// </summary>
        /// <param name="service">The NavigationService to be registered.</param>
        internal void RegisterNavigationService(NavigationServiceBase service)
        {
            //Null check.
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            //Check if the user is trying to register a top-level Navigation Service.
            if (RootNavigationService != null && service.NavigationLevel == FrameLevel.One)
            {
                throw new Exception("There can only be one level-one navigation service.");
            }

            //If it isn't already in the list, add it.
            if (!navigationServices.Contains(service))
            {
                navigationServices.Add(service);
            }
        }
コード例 #3
0
        public void RegisterCustomNavigationService(NavigationServiceBase service, FrameLevel frameLevel = FrameLevel.Two)
        {
            //Check if the user is trying to register a top-level Navigation Service.
            if (RootNavigationService != null && frameLevel == FrameLevel.One)
            {
                throw new Exception("There can only be one level-one navigation service.");
            }

            //If it isn't already in the list, add it.
            if (navigationServices.Any(x => x.NavigationLevel == frameLevel))
            {
                throw new Exception();
            }

            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            service.NavigationLevel   = frameLevel;
            service.NavigationManager = this;

            navigationServices.Add(service);
        }