40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
|
// /**
|
|||
|
// * File: RenderContext.cs
|
|||
|
// * Author: haraldwolff
|
|||
|
// *
|
|||
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
|||
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
|||
|
// *
|
|||
|
// *
|
|||
|
// **/
|
|||
|
using System;
|
|||
|
using System.IO;
|
|||
|
using System.Collections.Generic;
|
|||
|
using ln.templates.script;
|
|||
|
namespace ln.templates.html
|
|||
|
{
|
|||
|
public class RenderContext : IScriptContext
|
|||
|
{
|
|||
|
public TextWriter ContentWriter { get; }
|
|||
|
public ITemplateSource TemplateSource { get; set; }
|
|||
|
|
|||
|
Dictionary<string, object> scriptObjects = new Dictionary<string, object>();
|
|||
|
public IEnumerable<string> ScriptObjectNames => scriptObjects.Keys;
|
|||
|
|
|||
|
public RenderContext(TextWriter contentWriter)
|
|||
|
{
|
|||
|
ContentWriter = contentWriter;
|
|||
|
}
|
|||
|
public RenderContext(TextWriter contentWriter,ITemplateSource templateSource)
|
|||
|
:this(contentWriter)
|
|||
|
{
|
|||
|
TemplateSource = templateSource;
|
|||
|
}
|
|||
|
|
|||
|
Dictionary<string, object> values = new Dictionary<string, object>();
|
|||
|
|
|||
|
public object GetScriptObject(string itemName) => scriptObjects[itemName];
|
|||
|
public void SetScriptObject(string itemName, object value) => scriptObjects[itemName] = value;
|
|||
|
}
|
|||
|
}
|