浏览代码

removed plugin configuration pages from the kernel

LukePulverenti 12 年之前
父节点
当前提交
176d090164

+ 0 - 7
MediaBrowser.Controller/Kernel.cs

@@ -74,12 +74,6 @@ namespace MediaBrowser.Controller
         /// <value>The string files.</value>
         public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
 
-        /// <summary>
-        /// Gets the list of plugin configuration pages
-        /// </summary>
-        /// <value>The configuration pages.</value>
-        public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
-
         /// <summary>
         /// Gets the list of currently registered weather prvoiders
         /// </summary>
@@ -204,7 +198,6 @@ namespace MediaBrowser.Controller
             DisplayPreferencesRepositories = ApplicationHost.GetExports<IDisplayPreferencesRepository>();
             ItemRepositories = ApplicationHost.GetExports<IItemRepository>();
             WeatherProviders = ApplicationHost.GetExports<IWeatherProvider>();
-            PluginConfigurationPages = ApplicationHost.GetExports<IPluginConfigurationPage>();
             ImageEnhancers = ApplicationHost.GetExports<IImageEnhancer>().OrderBy(e => e.Priority).ToArray();
             StringFiles = ApplicationHost.GetExports<LocalizedStringData>();
             MetadataProviders = ApplicationHost.GetExports<BaseMetadataProvider>().OrderBy(e => e.Priority).ToArray();

+ 1 - 1
MediaBrowser.ServerApplication/WebSocketEvents.cs

@@ -14,7 +14,7 @@ namespace MediaBrowser.ServerApplication
     /// <summary>
     /// Class WebSocketEvents
     /// </summary>
-    public class WebSocketEvents : IServerEntryPoint, IDisposable
+    public class WebSocketEvents : IServerEntryPoint
     {
         /// <summary>
         /// The _server manager

+ 2 - 2
MediaBrowser.WebDashboard/Api/DashboardService.cs

@@ -147,7 +147,7 @@ namespace MediaBrowser.WebDashboard.Api
         /// <returns>System.Object.</returns>
         public object Get(GetDashboardConfigurationPage request)
         {
-            var page = Kernel.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
+            var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
 
             return ToStaticResult(page.Version.GetMD5(), page.DateLastModified, null, MimeTypes.GetMimeType("page.html"), () => ModifyHtml(page.GetHtmlStream()));
         }
@@ -159,7 +159,7 @@ namespace MediaBrowser.WebDashboard.Api
         /// <returns>System.Object.</returns>
         public object Get(GetDashboardConfigurationPages request)
         {
-            var pages = Kernel.Instance.PluginConfigurationPages;
+            var pages = ServerEntryPoint.Instance.PluginConfigurationPages;
 
             if (request.PageType.HasValue)
             {

+ 1 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -85,6 +85,7 @@
     <Compile Include="Api\DashboardService.cs" />
     <Compile Include="Api\DashboardInfoWebSocketListener.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ServerEntryPoint.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\MediaBrowser.Common.Implementations\MediaBrowser.Common.Implementations.csproj">

+ 34 - 0
MediaBrowser.WebDashboard/ServerEntryPoint.cs

@@ -0,0 +1,34 @@
+using MediaBrowser.Common;
+using MediaBrowser.Controller.Plugins;
+using System.Collections.Generic;
+
+namespace MediaBrowser.WebDashboard
+{
+    public class ServerEntryPoint : IServerEntryPoint
+    {
+        /// <summary>
+        /// Gets the list of plugin configuration pages
+        /// </summary>
+        /// <value>The configuration pages.</value>
+        public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
+
+        private readonly IApplicationHost _appHost;
+
+        public static ServerEntryPoint Instance { get; private set; }
+
+        public ServerEntryPoint(IApplicationHost appHost)
+        {
+            _appHost = appHost;
+            Instance = this;
+        }
+
+        public void Run()
+        {
+            PluginConfigurationPages = _appHost.GetExports<IPluginConfigurationPage>();
+        }
+
+        public void Dispose()
+        {
+        }
+    }
+}