Beispiel #1
0
        public WebRegistry()
        {
            ForRequestedType<IViewFolder>().AsSingletons().TheDefault.Is.ConstructedBy(
                ctx =>
                {
                    var folder = new VirtualPathProviderViewFolder(ctx.GetInstance<FubuConventions>().ViewFileBasePath);
                    folder.AddSharedPath(ctx.GetInstance<SparkConventions>().LayoutViewFileBasePath);
                    return folder;
                });

            ForRequestedType<ISparkSettings>().TheDefault.IsThis(new SparkSettings().AddNamespace("FubuTask.Presentation.Controllers"));

            ForRequestedType<ISparkViewEngine>().TheDefault.Is.OfConcreteType<SparkViewEngine>()
                .SetterDependency(e => e.Settings).IsTheDefault()
                .SetterDependency(e => e.ViewFolder).IsTheDefault();

            ForRequestedType<IResponseStatusService>().TheDefault.Is.OfConcreteType<ResponseStatusService>();

            ForRequestedType<IViewRenderer>().TheDefault.Is.OfConcreteType<SparkViewRenderer>();

            ForRequestedType<SparkConventions>().AsSingletons().TheDefault.Is.ConstructedBy(
                ctx => new SparkConventions(ctx.GetInstance<FubuConventions>()));

            ForRequestedType<IPrincipalFactory>()
                .TheDefault.Is.OfConcreteType<LoggedOnPrincipleFactory>();

            //ForRequestedType<ISecurityDataService>().TheDefault.Is.OfConcreteType<SecurityDataService>();
        }
Beispiel #2
0
        public void AddTheme(string name)
        {
            IViewFolder themeFolder = new VirtualPathProviderViewFolder("~/Themes/" + name);
            themeFolder = themeFolder.Append(_defaultViewFolder);

            var container = SparkEngineStarter.CreateContainer();
            container.SetService(themeFolder);
            _themedEngines.Add(name, container.GetService<IViewEngine>());
        }
        public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
        {
            var proposedFolder = GetSparkViewPath(call);
            var proposedFile = GetSparkViewFile(call);

            var sparkFolder = new VirtualPathProviderViewFolder(proposedFolder);

            return ( sparkFolder.HasView(proposedFile))
                 ? new IViewToken[]{new SparkViewToken(proposedFolder + "/" + proposedFile)}
                 : new IViewToken[0];
        }