Files
Disco/Disco.Services/Plugins/Features/UIExtension/Results/PluginResourceCssResult.cs
T
Gary Sharp 9784c5d282 Plugin Base WebViewPage #22 & Authorization #24
Plugins have a base WebViewPage to inherit, this offers integration with
various Disco services. Plugins can also add Authorization attributes to
their Web Handlers and Controller Methods.
2013-10-14 20:13:00 +11:00

40 lines
1.2 KiB
C#

using Disco.Services.Web.Bundles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Disco.Services.Plugins.Features.UIExtension.Results
{
public class PluginResourceCssResult : UIExtensionResult
{
private string _resource;
private HtmlString _resourceUrl;
public PluginResourceCssResult(PluginFeatureManifest Source, string Resource)
: base(Source)
{
this._resource = Resource;
this._resourceUrl = new HtmlString(Source.PluginManifest.WebResourceUrl(Resource));
var deferredBundles = HttpContext.Current.Items[Bundle.UIExtensionCssKey] as List<HtmlString>;
if (deferredBundles == null)
{
deferredBundles = new List<HtmlString>();
HttpContext.Current.Items[Bundle.UIExtensionCssKey] = deferredBundles;
}
if (!deferredBundles.Contains(this._resourceUrl))
deferredBundles.Add(this._resourceUrl);
}
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
{
// Nothing Done
}
}
}