public virtual IViewComponentResult Invoke()
 {
     return(View(
                "~/Aiwins/Rocket/AspNetCore/Mvc/UI/Widgets/Components/WidgetScripts/Default.cshtml",
                new WidgetResourcesViewModel
     {
         Widgets = PageWidgetManager.GetAll()
     }
                ));
 }
示例#2
0
 public virtual IViewComponentResult Invoke()
 {
     return(View(
                "~/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetStyles/Default.cshtml",
                new WidgetResourcesViewModel
     {
         Widgets = PageWidgetManager.GetAll()
     }
                ));
 }
示例#3
0
    protected virtual async Task <IHtmlContent> InvokeWidgetAsync(object arguments, WidgetDefinition widget)
    {
        PageWidgetManager.TryAdd(widget);

        var wrapperAttributesBuilder = new StringBuilder($"class=\"abp-widget-wrapper\" data-widget-name=\"{widget.Name}\"");

        if (widget.RefreshUrl != null)
        {
            wrapperAttributesBuilder.Append($" data-refresh-url=\"{widget.RefreshUrl}\"");
        }

        if (widget.AutoInitialize)
        {
            wrapperAttributesBuilder.Append(" data-widget-auto-init=\"true\"");
        }

        return(new HtmlContentBuilder()
               .AppendHtml($"<div {wrapperAttributesBuilder}>")
               .AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments))
               .AppendHtml("</div>"));
    }