Exemple #1
0
        public Task <ViewBag> BuildViewBag(BehaviorGraph graph)
        {
            return(PackageRegistry.Timer.RecordTask("Building the View Bag", () => {
                var viewFinders = _facilities.Select(x =>
                {
                    return Task.Factory.StartNew(() =>
                    {
                        x.Fill(this, graph);
                        return x.AllViews();
                    });
                });

                var views = viewFinders.SelectMany(x => x.Result).ToList();
                _viewPolicies.Each(x => x.Alter(views));

                var logger = TemplateLogger.Default();
                var types = new ViewTypePool(graph);

                // Attaching the view models

                _facilities.Each(x => x.AttachViewModels(types, logger));

                return new ViewBag(views);
            }));
        }
Exemple #2
0
        public TemplatePlan(string rootDirectory)
        {
            Root       = rootDirectory;
            SourceName = "src";

            Logger = new TemplateLogger();
        }
Exemple #3
0
        public Task <ViewBag> BuildViewBag(BehaviorGraph graph, IActivationDiagnostics diagnostics, IFubuApplicationFiles files)
        {
            return(diagnostics.Timer.RecordTask("Building the View Bag", () =>
            {
                var viewFinders = _facilities.Select(x =>
                {
                    return Task.Factory.StartNew(() =>
                    {
                        x.Fill(this, graph, diagnostics.Timer, files);
                        return x.AllViews();
                    });
                });

                var views = viewFinders.SelectMany(x => x.Result).ToList();
                _viewPolicies.Each(x => x.Alter(views));

                var logger = TemplateLogger.Default(diagnostics);
                var types = new ViewTypePool(graph);

                // Attaching the view models

                _facilities.Each(x => x.AttachViewModels(types, logger));

                _facilities.Each(x => x.AttachLayouts(this));

                return new ViewBag(views);
            }));
        }