From 53450bd514eec97d58eb18b8a01feab36475826b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 6 Jul 2013 17:23:32 -0400 Subject: added a notifications service --- .../Updates/InstallationManager.cs | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'MediaBrowser.Common.Implementations/Updates') diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index ba2cd7baa..e7af4004b 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -21,10 +21,10 @@ namespace MediaBrowser.Common.Implementations.Updates /// public class InstallationManager : IInstallationManager { - public event EventHandler> PackageInstalling; - public event EventHandler> PackageInstallationCompleted; - public event EventHandler> PackageInstallationFailed; - public event EventHandler> PackageInstallationCancelled; + public event EventHandler PackageInstalling; + public event EventHandler PackageInstallationCompleted; + public event EventHandler PackageInstallationFailed; + public event EventHandler PackageInstallationCancelled; /// /// The current installations @@ -384,7 +384,13 @@ namespace MediaBrowser.Common.Implementations.Updates var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, innerCancellationTokenSource.Token).Token; - EventHelper.QueueEventIfNotNull(PackageInstalling, this, new GenericEventArgs { Argument = installationInfo }, _logger); + var installationEventArgs = new InstallationEventArgs + { + InstallationInfo = installationInfo, + PackageVersionInfo = package + }; + + EventHelper.QueueEventIfNotNull(PackageInstalling, this, installationEventArgs, _logger); try { @@ -397,7 +403,7 @@ namespace MediaBrowser.Common.Implementations.Updates CompletedInstallations.Add(installationInfo); - EventHelper.QueueEventIfNotNull(PackageInstallationCompleted, this, new GenericEventArgs { Argument = installationInfo }, _logger); + EventHelper.QueueEventIfNotNull(PackageInstallationCompleted, this, installationEventArgs, _logger); } catch (OperationCanceledException) { @@ -408,7 +414,7 @@ namespace MediaBrowser.Common.Implementations.Updates _logger.Info("Package installation cancelled: {0} {1}", package.name, package.versionStr); - EventHelper.QueueEventIfNotNull(PackageInstallationCancelled, this, new GenericEventArgs { Argument = installationInfo }, _logger); + EventHelper.QueueEventIfNotNull(PackageInstallationCancelled, this, installationEventArgs, _logger); throw; } @@ -421,7 +427,12 @@ namespace MediaBrowser.Common.Implementations.Updates CurrentInstallations.Remove(tuple); } - EventHelper.QueueEventIfNotNull(PackageInstallationFailed, this, new GenericEventArgs { Argument = installationInfo }, _logger); + EventHelper.QueueEventIfNotNull(PackageInstallationFailed, this, new InstallationFailedEventArgs + { + InstallationInfo = installationInfo, + Exception = ex + + }, _logger); throw; } -- cgit v1.2.3