Added is running as service to IServerApplicationHost

This commit is contained in:
Luke Pulverenti 2014-01-29 19:18:05 -05:00
parent fb69d5b76d
commit d39f8a1161
4 changed files with 24 additions and 5 deletions

View File

@ -20,6 +20,12 @@ namespace MediaBrowser.Controller
/// <value>The name of the web application.</value>
string WebApplicationName { get; }
/// <summary>
/// Gets a value indicating whether this instance is running as service.
/// </summary>
/// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
bool IsRunningAsService { get; }
/// <summary>
/// Gets a value indicating whether [supports automatic run at startup].
/// </summary>

View File

@ -19,7 +19,13 @@ namespace MediaBrowser.Model.System
/// </summary>
/// <value>The operating sytem.</value>
public string OperatingSystem { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is running as service.
/// </summary>
/// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
public bool IsRunningAsService { get; set; }
/// <summary>
/// Gets or sets the mac address.
/// </summary>

View File

@ -179,10 +179,16 @@ namespace MediaBrowser.ServerApplication
/// </summary>
/// <param name="applicationPaths">The application paths.</param>
/// <param name="logManager">The log manager.</param>
public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager)
public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager, bool isRunningAsService)
: base(applicationPaths, logManager)
{
_isRunningAsService = isRunningAsService;
}
private readonly bool _isRunningAsService;
public bool IsRunningAsService
{
get { return _isRunningAsService; }
}
/// <summary>
@ -431,7 +437,7 @@ namespace MediaBrowser.ServerApplication
await ItemRepository.Initialize().ConfigureAwait(false);
await ProviderRepository.Initialize().ConfigureAwait(false);
((LibraryManager)LibraryManager).ItemRepository = ItemRepository;
}
@ -687,7 +693,8 @@ namespace MediaBrowser.ServerApplication
WanAddress = GetWanAddress(),
HasUpdateAvailable = _hasUpdateAvailable,
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
TranscodingTempPath = ApplicationPaths.TranscodingTempPath
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
IsRunningAsService = IsRunningAsService
};
}

View File

@ -212,7 +212,7 @@ namespace MediaBrowser.ServerApplication
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
_appHost = new ApplicationHost(appPaths, logManager);
_appHost = new ApplicationHost(appPaths, logManager, runService);
_app = new App(_appHost, _appHost.LogManager.GetLogger("App"), runService);