コード例 #1
0
ファイル: ImageView.cs プロジェクト: kaiaverkvist/Spartan
        public string GetView(HttpListenerContext context, TemplatingProcessor templatingProcessor)
        {
            CurrentTime = DateTime.Now.ToUniversalTime().ToString(CultureInfo.InvariantCulture);
            Image       = "/public/fahrenheit-451.png";

            Test = context.Request.RemoteEndPoint.ToString();

            SpartanTemplate template = new SpartanTemplate("image.html", "test.html", templatingProcessor, this);

            // Render the template.
            return(template.Render());
        }
コード例 #2
0
        /// <summary>
        /// Initializes the route management class.
        /// This will also add all IView derived classes containing a RouteAttribute to a list.
        /// </summary>
        /// <param name="errorHandler"></param>
        public RouteManager(IErrorHandler errorHandler)
        {
            // Initialize the error handler.
            _errorHandler = errorHandler;

            // Create a list of views
            InitializeViews();

            // Create an instance of the static file processor
            _staticFileProcessor = new StaticFileProcessor();

            // Create an instance of the templating processor
            _templatingProcessor = new TemplatingProcessor(_errorHandler);
        }
コード例 #3
0
ファイル: TestView.cs プロジェクト: kaiaverkvist/Spartan
 public string GetView(HttpListenerContext context, TemplatingProcessor templatingProcessor)
 {
     return "View data from TestView";
 }