Beispiel #1
0
        private void InitHelpers(RazorComponentBase webPage, int compatibility)
        {
            webPage.Html    = new Razor.HtmlHelper();
            webPage.DynCode = new DnnDynamicCode().Init(Block, Log, compatibility);

            #region New in 10.25 - ensure jquery is not included by default

            if (compatibility == 10)
            {
                CompatibilityAutoLoadJQueryAndRVT = false;
            }

            #endregion
        }
Beispiel #2
0
        private void InitWebpage()
        {
            if (string.IsNullOrEmpty(TemplatePath))
            {
                return;
            }

            var objectValue = RuntimeHelpers.GetObjectValue(CreateWebPageInstance());

            // ReSharper disable once JoinNullCheckWithUsage
            if (objectValue == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "The webpage found at '{0}' was not created.", TemplatePath));
            }

            Webpage = objectValue as RazorComponentBase;

            if (Webpage == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "The webpage at '{0}' must derive from RazorComponentBase.", TemplatePath));
            }

            Webpage.Context     = HttpContext;
            Webpage.VirtualPath = TemplatePath;
            var compatibility = 9;

            if (Webpage is RazorComponent rzrPage)
            {
                rzrPage.Purpose = Purpose;
                compatibility   = 10;
            }
#pragma warning disable 618
            if (Webpage is SexyContentWebPage oldPage)
            {
                oldPage.InstancePurpose = (InstancePurposes)Purpose;
            }
#pragma warning restore 618
            InitHelpers(Webpage, compatibility);
        }