Update: Use Generics for Compiled View

Also standardize inclusion of StyleSheets/Scripts for Plugin Resources
This commit is contained in:
Gary Sharp
2013-10-21 20:05:33 +11:00
parent 4dfe9ad086
commit 401ae029f1
10 changed files with 92 additions and 36 deletions
@@ -20,17 +20,24 @@ namespace Disco.Services.Plugins
// Nothing in Base Class
}
[Obsolete("Use: Response<ViewType>(dynamic ViewModel)")]
protected PluginConfigurationHandlerGetResponse GetResponse(Type ViewType, dynamic ViewModel = null)
{
return new PluginConfigurationHandlerGetResponse(this.Manifest, ViewType, ViewModel);
}
protected PluginConfigurationHandlerGetResponse Response<ViewType>(dynamic Model = null) where ViewType : WebViewPage
{
return new PluginConfigurationHandlerGetResponse(this.Manifest, typeof(ViewType), Model);
}
public class PluginConfigurationHandlerGetResponse
{
public PluginManifest Manifest { get; set; }
public Type ViewType { get; set; }
public dynamic ViewModel { get; set; }
public dynamic Model { get; set; }
public PluginConfigurationHandlerGetResponse(PluginManifest Manifest, Type ViewType, dynamic ViewModel = null)
public PluginConfigurationHandlerGetResponse(PluginManifest Manifest, Type ViewType, dynamic Model = null)
{
if (ViewType == null)
throw new ArgumentNullException("ViewType");
@@ -40,7 +47,7 @@ namespace Disco.Services.Plugins
this.Manifest = Manifest;
this.ViewType = ViewType;
this.ViewModel = ViewModel;
this.Model = Model;
}
}
}