Esempio n. 1
0
        /// <summary>
        ///     Checks if the current browser is at the given page
        /// </summary>
        /// <param name="document"></param>
        /// <param name="pageType"></param>
        /// <returns></returns>
        public static bool IsAtPage(this INavigationService document, Type pageType)
        {
            PageDescriptionAttribute navigationInfo = TryGetPageDescriptionAttribute(pageType);

            if (navigationInfo == null)
            {
                throw new InvalidOperationException("The page type does not specify its uri");
            }

            return(UrlHelpers.MatchUrlPattern(navigationInfo.PageUrl, document.Document.Uri));
        }
        /// <summary>
        ///     Checks if the current browser is at the given page
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="document"></param>
        /// <returns></returns>
        public static bool IsAtPage(this INavigationService document, Type pageType)
        {
            PageDescriptionAttribute navigationInfo = TryGetPageDescriptionAttribute(pageType);

            if (navigationInfo == null)
            {
                throw new InvalidOperationException("The page type does not specify its uri");
            }


            return(UrlHelpers.UrlsAreEqual(ProcessUrlArguments(navigationInfo.Url, null), document.Document.Uri));
        }