made RegisterResources a Task

This commit is contained in:
LukePulverenti 2013-03-04 13:13:47 -05:00
parent 0268dcec05
commit 46480f1187
5 changed files with 45 additions and 45 deletions

View File

@ -154,9 +154,7 @@ namespace MediaBrowser.Common.Implementations
/// Inits this instance. /// Inits this instance.
/// </summary> /// </summary>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public virtual Task Init() public virtual async Task Init()
{
return Task.Run(() =>
{ {
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted; IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
@ -170,14 +168,13 @@ namespace MediaBrowser.Common.Implementations
Kernel = GetKernel(); Kernel = GetKernel();
RegisterResources(); await RegisterResources().ConfigureAwait(false);
FindParts(); FindParts();
Task.Run(() => ConfigureAutoRunAtStartup()); Task.Run(() => ConfigureAutoRunAtStartup());
Kernel.Init(); Kernel.Init();
});
} }
/// <summary> /// <summary>
@ -224,7 +221,9 @@ namespace MediaBrowser.Common.Implementations
/// <summary> /// <summary>
/// Registers resources that classes will depend on /// Registers resources that classes will depend on
/// </summary> /// </summary>
protected virtual void RegisterResources() protected virtual Task RegisterResources()
{
return Task.Run(() =>
{ {
RegisterSingleInstance(ConfigurationManager); RegisterSingleInstance(ConfigurationManager);
RegisterSingleInstance<IApplicationHost>(this); RegisterSingleInstance<IApplicationHost>(this);
@ -262,6 +261,7 @@ namespace MediaBrowser.Common.Implementations
RegisterSingleInstance(SecurityManager); RegisterSingleInstance(SecurityManager);
RegisterSingleInstance<IPackageManager>(new PackageManager(SecurityManager, networkManager, httpClient, ApplicationPaths, JsonSerializer, Logger)); RegisterSingleInstance<IPackageManager>(new PackageManager(SecurityManager, networkManager, httpClient, ApplicationPaths, JsonSerializer, Logger));
});
} }
/// <summary> /// <summary>

View File

@ -95,9 +95,9 @@ namespace MediaBrowser.ServerApplication
/// <summary> /// <summary>
/// Registers resources that classes will depend on /// Registers resources that classes will depend on
/// </summary> /// </summary>
protected override void RegisterResources() protected override async Task RegisterResources()
{ {
base.RegisterResources(); await base.RegisterResources().ConfigureAwait(false);
RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths); RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.30</version> <version>3.0.31</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.30" /> <dependency id="MediaBrowser.Common" version="3.0.31" />
<dependency id="NLog" version="2.0.0.2000" /> <dependency id="NLog" version="2.0.0.2000" />
<dependency id="ServiceStack" version="3.9.38" /> <dependency id="ServiceStack" version="3.9.38" />
<dependency id="ServiceStack.Api.Swagger" version="3.9.38" /> <dependency id="ServiceStack.Api.Swagger" version="3.9.38" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.30</version> <version>3.0.31</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.30</version> <version>3.0.31</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.30" /> <dependency id="MediaBrowser.Common" version="3.0.31" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>