public IEnumerable <IViewToken> FindViews(TypePool types, BehaviorGraph graph)
 {
     // clean up pending
     return(_templateRegistry
            .AllTemplates()
            .Where(x => x.Descriptor is ViewDescriptor)
            .Select(x => x.Descriptor.As <ViewDescriptor>())
            .Where(x => x.HasViewModel())
            .Select(x => new SparkViewToken(x)));
 }
示例#2
0
        public void Compose(ITemplateRegistry templates)
        {
            templates.AllTemplates().Each(t =>
            {
                var bindRequest = createBindRequest(t, templates);

                var binders  = _binders.Where(x => x.CanBind(bindRequest));
                var policies = _policies.Where(x => x.Matches(t));

                binders.Each(binder => binder.Bind(bindRequest));
                policies.Each(policy => policy.Apply(t));
            });
        }
        private void setEngineDependencies(IPackageLog log)
        {
            var engine = (SparkViewEngine)_engine;

            engine.ViewFolder = new TemplateViewFolder(_templateRegistry.AllTemplates());
            log.Trace("Setting viewfolder [{0}] for view engine", _engine.ViewFolder.GetType().FullName);

            engine.DefaultPageBaseType = typeof(FubuSparkView).FullName;
            log.Trace("Setting page base type [{0}] for views", _engine.DefaultPageBaseType);

            engine.BindingProvider = new FubuBindingProvider(_templateRegistry);
            log.Trace("Setting binding provider [{0}] for view engine", engine.BindingProvider.GetType().FullName);
        }
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            _templates.AllTemplates().Each(t =>
            {
                var context = new AttachRequest
                {
                    Template = t,
                    Logger   = SparkLogger.Default()
                };

                _attachers.Where(a => a.CanAttach(context)).Each(a => a.Attach(context));
            });
        }
示例#5
0
        public IEnumerable <IViewToken> FindViews(TypePool types, BehaviorGraph graph)
        {
            // TODO: Make it not filter against view model as the
            // default view attacher conventions will do this.
            // Opens up for returning view with no model in edge cases
            // and add custom view attacher convention.

            return(_templateRegistry
                   .AllTemplates()
                   .Where(x => x.Descriptor is ViewDescriptor)
                   .Select(x => x.Descriptor.As <ViewDescriptor>())
                   .Where(x => x.HasViewModel())
                   .Select(x => new SparkViewToken(x)));
        }
示例#6
0
        public ITemplateRegistry Compose(TypePool typePool)
        {
            _templateRegistry.AllTemplates().Each(t =>
            {
                var bindRequest = createBindRequest(t, typePool);

                var binders  = _binders.Where(x => x.CanBind(bindRequest));
                var policies = _policies.Where(x => x.Matches(t));

                binders.Each(binder => binder.Bind(bindRequest));
                policies.Each(policy => policy.Apply(t));
            });

            return(_templateRegistry);
        }
        public void Compose(ITemplateRegistry templates)
        {
            templates.AllTemplates().Each(t =>
            {
                var bindRequest = new BindRequest
                {
                    Target           = t,
                    Parsing          = _parsings.ParsingFor(t),
                    Types            = _types,
                    TemplateRegistry = templates,
                    Logger           = SparkLogger.Default()
                };

                var binders  = _binders.Where(x => x.CanBind(bindRequest));
                var policies = _policies.Where(x => x.Matches(t));

                binders.Each(binder => binder.Bind(bindRequest));
                policies.Each(policy => policy.Apply(t));
            });
        }
示例#8
0
 private void setEngineDependencies()
 {
     _engine.ViewFolder          = new TemplateViewFolder(_templateRegistry.AllTemplates());
     _engine.DefaultPageBaseType = typeof(FubuSparkView).FullName;
     ((SparkViewEngine)_engine).BindingProvider = new FubuBindingProvider(_templateRegistry);
 }