Esempio n. 1
0
 private void InitHelpers(OpenContentWebPage webPage)
 {
     if (ModuleContext != null)
     {
         webPage.Dnn  = new DnnHelper(ModuleContext);
         webPage.Html = new HtmlHelper(ModuleContext, LocalResourceFile);
         webPage.Url  = new UrlHelper(ModuleContext);
     }
 }
Esempio n. 2
0
 private void InitWebpage()
 {
     if (!string.IsNullOrEmpty(RazorScriptFile))
     {
         var objectValue = RuntimeHelpers.GetObjectValue(CreateWebPageInstance());
         if (objectValue == null)
         {
             throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "The webpage found at '{0}' was not created.", new object[] { RazorScriptFile }));
         }
         Webpage = objectValue as OpenContentWebPage;
         if (Webpage == null)
         {
             throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "The webpage at '{0}' must derive from OpenContentWebPage.", new object[] { RazorScriptFile }));
         }
         Webpage.Context     = HttpContextBase;
         Webpage.VirtualPath = VirtualPathUtility.GetDirectory(RazorScriptFile);
         if (RenderContext != null) //called from a skin object?  todo: can we improve this? Inithelpers not initialized now.
         {
             RenderContext.InitHelpers(Webpage, LocalResourceFile);
         }
     }
 }