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

35 lines
907 B
C#
Raw Normal View History

using System;
2017-01-21 21:27:07 +01:00
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.System;
2016-11-14 07:44:21 +01:00
namespace Emby.Server.Implementations.EntryPoints
{
public class SystemEvents : IServerEntryPoint
{
private readonly ISystemEvents _systemEvents;
2017-01-21 21:27:07 +01:00
private readonly IServerApplicationHost _appHost;
2016-11-14 07:44:21 +01:00
2017-01-21 21:27:07 +01:00
public SystemEvents(ISystemEvents systemEvents, IServerApplicationHost appHost)
2016-11-14 07:44:21 +01: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;
}
}
}