2013-09-21 01:04:14 +00:00
using MediaBrowser.Model.Logging ;
2015-05-23 20:44:15 +00:00
using System.Linq ;
2013-09-21 01:04:14 +00:00
using System.ServiceProcess ;
2013-09-20 17:32:10 +00:00
namespace MediaBrowser.ServerApplication
{
2013-09-21 01:04:14 +00:00
/// <summary>
/// Class BackgroundService
/// </summary>
2013-09-20 17:32:10 +00:00
public class BackgroundService : ServiceBase
{
2015-05-23 20:44:15 +00:00
public static string Name = "Emby" ;
public static string DisplayName = "Emby Server" ;
public static string GetExistingServiceName ( )
{
return Name ;
}
2013-09-21 01:04:14 +00:00
private readonly ILogger _logger ;
/// <summary>
/// Initializes a new instance of the <see cref="BackgroundService"/> class.
/// </summary>
public BackgroundService ( ILogger logger )
2013-09-20 17:32:10 +00:00
{
2013-09-21 01:04:14 +00:00
_logger = logger ;
2013-09-20 17:32:10 +00:00
CanPauseAndContinue = false ;
2013-09-21 01:04:14 +00:00
CanStop = true ;
2013-09-20 17:32:10 +00:00
2015-05-23 20:44:15 +00:00
ServiceName = GetExistingServiceName ( ) ;
2013-09-20 17:32:10 +00:00
}
2013-09-21 01:04:14 +00:00
/// <summary>
/// When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.
/// </summary>
protected override void OnStop ( )
2013-09-20 17:32:10 +00:00
{
2013-09-21 01:04:14 +00:00
_logger . Info ( "Stop command received" ) ;
base . OnStop ( ) ;
2013-09-20 17:32:10 +00:00
}
}
}