コード例 #1
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var descriptor = _widgetHarvester.HarvestWidgets().Last();

            var renderer = _lifetimeScope.ResolveNamed<Lazy<IRenderer>>(descriptor.RendererDescriptor.RendererName,new PositionalParameter(0, descriptor.RendererDescriptor.Model));
            var context = new WidgetRenderContext(renderer,"Page1", "page", "Widget1", descriptor.Name, new Dictionary<string, object>());

            var widgetRenderer = _lifetimeScope.Resolve<Lazy<IWidgetRenderer>>(new PositionalParameter(0, context));

            var page = new Page(() => _pageRenderEventses.Value)
            {
                Widgets = new IWidget[]
                {
                    new Widget(descriptor,widgetRenderer)
                }
            };
            return View(page);
        }
コード例 #2
0
 public WidgetRenderer(WidgetRenderContext renderContext)
 {
     _renderContext = renderContext;
 }