jellyfin/Emby.Server.Implementations/EntryPoints/SystemEvents.cs

35 lines
907 B
C#
Raw Normal View History

using System;
2017-01-21 20:27:07 +00:00
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.System;
2016-11-14 06:44:21 +00:00
namespace Emby.Server.Implementations.EntryPoints
{
public class SystemEvents : IServerEntryPoint
{
private readonly ISystemEvents _systemEvents;
2017-01-21 20:27:07 +00:00
private readonly IServerApplicationHost _appHost;
2016-11-14 06:44:21 +00:00
2017-01-21 20:27:07 +00:00
public SystemEvents(ISystemEvents systemEvents, IServerApplicationHost appHost)
2016-11-14 06:44:21 +00:00
{
_systemEvents = systemEvents;
_appHost = appHost;
}
public void Run()
{
_systemEvents.SystemShutdown += _systemEvents_SystemShutdown;
}
private void _systemEvents_SystemShutdown(object sender, EventArgs e)
{
_appHost.Shutdown();
}
public void Dispose()
{
_systemEvents.SystemShutdown -= _systemEvents_SystemShutdown;
}
}
}