diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-08-15 23:20:41 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-08-15 23:20:41 -0400 |
| commit | a40064a146da17a49582f7ef1ad754a497725ccc (patch) | |
| tree | 4d331c4e549e3dfcf3ca106fc305e6007de964f9 /Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs | |
| parent | e82dd8b70ee5fe1d09c7230a7de21f47456b8c55 (diff) | |
Migrate ServerEventNotifier.OnPackageInstallationCancelled to IEventConsumer
Diffstat (limited to 'Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs')
| -rw-r--r-- | Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs deleted file mode 100644 index 1fbb9f303..000000000 --- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Common.Updates; -using MediaBrowser.Controller.Plugins; -using MediaBrowser.Controller.Session; -using MediaBrowser.Model.Updates; - -namespace Emby.Server.Implementations.EntryPoints -{ - /// <summary> - /// Class WebSocketEvents. - /// </summary> - public class ServerEventNotifier : IServerEntryPoint - { - /// <summary> - /// The installation manager. - /// </summary> - private readonly IInstallationManager _installationManager; - - private readonly ISessionManager _sessionManager; - - /// <summary> - /// Initializes a new instance of the <see cref="ServerEventNotifier"/> class. - /// </summary> - /// <param name="installationManager">The installation manager.</param> - /// <param name="sessionManager">The session manager.</param> - public ServerEventNotifier( - IInstallationManager installationManager, - ISessionManager sessionManager) - { - _installationManager = installationManager; - _sessionManager = sessionManager; - } - - /// <inheritdoc /> - public Task RunAsync() - { - _installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled; - - return Task.CompletedTask; - } - - private async void OnPackageInstallationCancelled(object sender, InstallationInfo e) - { - await SendMessageToAdminSessions("PackageInstallationCancelled", e).ConfigureAwait(false); - } - - private async Task SendMessageToAdminSessions<T>(string name, T data) - { - try - { - await _sessionManager.SendMessageToAdminSessions(name, data, CancellationToken.None).ConfigureAwait(false); - } - catch (Exception) - { - } - } - - /// <inheritdoc /> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) - { - if (dispose) - { - _installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled; - } - } - } -} |
