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

41 lines
1.1 KiB
C#
Raw Normal View History

2016-11-14 06:44:21 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MediaBrowser.Model.System;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Common;
2017-01-21 20:27:07 +00:00
using MediaBrowser.Controller;
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;
2017-09-05 19:49:02 +00:00
GC.SuppressFinalize(this);
2016-11-14 06:44:21 +00:00
}
}
}