Tidy: Sort/remove usings, simplify names

This commit is contained in:
Gary Sharp
2017-03-25 15:29:51 +11:00
parent 526f8547f7
commit ed66f4f285
168 changed files with 708 additions and 1175 deletions
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Services.Plugins.Features.InteroperabilityProvider
namespace Disco.Services.Plugins.Features.InteroperabilityProvider
{
[PluginFeatureCategory(DisplayName = "Interoperability Providers")]
public abstract class InteroperabilityProviderFeature : PluginFeature
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Services.Plugins.Features.Other
namespace Disco.Services.Plugins.Features.Other
{
[PluginFeatureCategory(DisplayName = "Other")]
public abstract class OtherFeature : PluginFeature
@@ -4,8 +4,6 @@ using Disco.Models.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace Disco.Services.Plugins.Features.RepairProvider
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web;
using System.Web.Mvc;
namespace Disco.Services.Plugins.Features.UIExtension.Results
@@ -15,7 +10,7 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
public LiteralResult(PluginFeatureManifest Source, string Content)
: base(Source)
{
this._content = Content;
_content = Content;
}
public override void ExecuteResult<T>(WebViewPage<T> page)
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace Disco.Services.Plugins.Features.UIExtension.Results
@@ -16,12 +13,12 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
if (Results == null || Results.Length == 0)
throw new ArgumentException("At least one result is required", "Results");
this.results = Results;
results = Results;
}
public override void ExecuteResult<T>(WebViewPage<T> page)
{
foreach (var result in this.results)
foreach (var result in results)
{
result.ExecuteResult(page);
page.WriteLiteral("\n");
@@ -1,12 +1,6 @@
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
{
@@ -18,8 +12,8 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
public PluginResourceCssResult(PluginFeatureManifest Source, string Resource)
: base(Source)
{
this._resource = Resource;
this._resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
_resource = Resource;
_resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
var deferredBundles = HttpContext.Current.Items[BundleTable.UIExtensionCssKey] as List<string>;
if (deferredBundles == null)
@@ -27,8 +21,8 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
deferredBundles = new List<string>();
HttpContext.Current.Items[BundleTable.UIExtensionCssKey] = deferredBundles;
}
if (!deferredBundles.Contains(this._resourceUrl))
deferredBundles.Add(this._resourceUrl);
if (!deferredBundles.Contains(_resourceUrl))
deferredBundles.Add(_resourceUrl);
}
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
@@ -1,9 +1,5 @@
using Disco.Services.Web.Bundles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Disco.Services.Plugins.Features.UIExtension.Results
@@ -17,11 +13,11 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
public PluginResourceScriptResult(PluginFeatureManifest Source, string Resource, bool PlaceInPageHead)
: base(Source)
{
this._resource = Resource;
this._resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
this._placeInPageHead = PlaceInPageHead;
_resource = Resource;
_resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
_placeInPageHead = PlaceInPageHead;
if (this._placeInPageHead)
if (_placeInPageHead)
{
var deferredBundles = HttpContext.Current.Items[BundleTable.UIExtensionScriptsKey] as List<string>;
if (deferredBundles == null)
@@ -29,14 +25,14 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
deferredBundles = new List<string>();
HttpContext.Current.Items[BundleTable.UIExtensionScriptsKey] = deferredBundles;
}
if (!deferredBundles.Contains(this._resourceUrl))
deferredBundles.Add(this._resourceUrl);
if (!deferredBundles.Contains(_resourceUrl))
deferredBundles.Add(_resourceUrl);
}
}
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
{
if (!this._placeInPageHead)
if (!_placeInPageHead)
{
page.WriteLiteral("<script src=\"");
page.WriteLiteral(_resourceUrl);
@@ -1,9 +1,4 @@
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.WebPages;
@@ -20,8 +15,8 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
if (!typeof(WebViewPage).IsAssignableFrom(ViewType))
throw new ArgumentException("The View Type must inherit from WebViewPage", "ViewType");
this.viewType = ViewType;
this.model = Model;
viewType = ViewType;
model = Model;
}
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
@@ -30,7 +25,7 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
if (partialView == null)
throw new InvalidOperationException("Invalid View Type");
partialView.ViewContext = page.ViewContext;
partialView.ViewData = new ViewDataDictionary(this.model);
partialView.ViewData = new ViewDataDictionary(model);
partialView.InitHelpers();
partialView.ExecutePageHierarchy(new WebPageContext(page.ViewContext.HttpContext, null, model), page.ViewContext.Writer, null);
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Disco.Models.UI;
using Disco.Services.Plugins.Features.UIExtension.Results;
@@ -23,11 +19,11 @@ namespace Disco.Services.Plugins.Features.UIExtension
}
public UIExtensionFeature()
{
this.plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => {
if (this.Context == null)
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => {
if (Context == null)
throw new InvalidOperationException("The Context property is not initialized");
return new WebHelper(this.Context.HttpContext, this.Manifest.PluginManifest);
return new WebHelper(Context.HttpContext, Manifest.PluginManifest);
}));
}
@@ -37,36 +33,36 @@ namespace Disco.Services.Plugins.Features.UIExtension
protected LiteralResult Literal(string Content)
{
return new LiteralResult(this.Manifest, Content);
return new LiteralResult(Manifest, Content);
}
protected LiteralResult Nothing()
{
return new LiteralResult(this.Manifest, null);
return new LiteralResult(Manifest, null);
}
protected LiteralResult ScriptInline(string JavaScriptContent)
{
return new LiteralResult(this.Manifest, string.Concat("<script type=\"text/javascript\">\n//<!--\n", JavaScriptContent, "\n//-->\n</script>"));
return new LiteralResult(Manifest, string.Concat("<script type=\"text/javascript\">\n//<!--\n", JavaScriptContent, "\n//-->\n</script>"));
}
protected PluginResourceScriptResult ScriptResource(string Resource, bool PlaceInPageHead)
{
return new PluginResourceScriptResult(this.Manifest, Resource, PlaceInPageHead);
return new PluginResourceScriptResult(Manifest, Resource, PlaceInPageHead);
}
protected PluginResourceCssResult CssResource(string Resource)
{
return new PluginResourceCssResult(this.Manifest, Resource);
return new PluginResourceCssResult(Manifest, Resource);
}
protected MultipleResult Multiple(params UIExtensionResult[] Results)
{
return new MultipleResult(this.Manifest, Results);
return new MultipleResult(Manifest, Results);
}
[Obsolete("Use: PartialCompiled<ViewType>(dynamic Model)")]
protected PrecompiledPartialViewResult Partial(Type PartialViewType, object Model = null)
{
return new PrecompiledPartialViewResult(this.Manifest, PartialViewType, Model);
return new PrecompiledPartialViewResult(Manifest, PartialViewType, Model);
}
protected PrecompiledPartialViewResult PartialCompiled<ViewType>(dynamic Model = null) where ViewType : WebViewPage
{
return new PrecompiledPartialViewResult(this.Manifest, typeof(ViewType), Model);
return new PrecompiledPartialViewResult(Manifest, typeof(ViewType), Model);
}
#endregion
@@ -1,10 +1,4 @@
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.Mvc;
namespace Disco.Services.Plugins.Features.UIExtension
{
@@ -1,15 +1,9 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Disco.Models.UI;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.UIExtension;
namespace Disco.Services.Plugins.Features.UIExtension
{
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Disco.Data.Repository;
using Disco.Models.BI.Config;
@@ -22,7 +20,7 @@ namespace Disco.Services.Plugins.Features.WarrantyProvider
public abstract string SubmitJob(DiscoDataContext Database, Job Job, OrganisationAddress Address, User TechUser, string FaultDescription, Dictionary<string, string> WarrantyProviderProperties);
public abstract Type JobDetailsViewType { get; }
public bool JobDetailsSupported { get { return this.JobDetailsViewType != null; } }
public bool JobDetailsSupported { get { return JobDetailsViewType != null; } }
public abstract dynamic JobDetailsViewModel(DiscoDataContext Database, Controller controller, Job Job);
public static PluginFeatureManifest FindPluginFeature(string PluginIdOrWarrantyProviderId)