From a86c131761d6040fe8ed23be878bf7ec783f4247 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 27 Aug 2013 17:54:26 -0700 Subject: [PATCH] Added CommandStartedEvent --- NzbDrone.Common/Messaging/CommandExecutedEvent.cs | 12 ++++++++++++ NzbDrone.Common/Messaging/CommandStartedEvent.cs | 4 ++-- NzbDrone.Common/Messaging/MessageAggregator.cs | 3 +-- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 NzbDrone.Common/Messaging/CommandExecutedEvent.cs diff --git a/NzbDrone.Common/Messaging/CommandExecutedEvent.cs b/NzbDrone.Common/Messaging/CommandExecutedEvent.cs new file mode 100644 index 000000000..3cb4e7f55 --- /dev/null +++ b/NzbDrone.Common/Messaging/CommandExecutedEvent.cs @@ -0,0 +1,12 @@ +namespace NzbDrone.Common.Messaging +{ + public class CommandExecutedEvent : IEvent + { + public ICommand Command { get; private set; } + + public CommandExecutedEvent(ICommand command) + { + Command = command; + } + } +} \ No newline at end of file diff --git a/NzbDrone.Common/Messaging/CommandStartedEvent.cs b/NzbDrone.Common/Messaging/CommandStartedEvent.cs index 3cb4e7f55..8c1b4163d 100644 --- a/NzbDrone.Common/Messaging/CommandStartedEvent.cs +++ b/NzbDrone.Common/Messaging/CommandStartedEvent.cs @@ -1,10 +1,10 @@ namespace NzbDrone.Common.Messaging { - public class CommandExecutedEvent : IEvent + public class CommandStartedEvent : IEvent { public ICommand Command { get; private set; } - public CommandExecutedEvent(ICommand command) + public CommandStartedEvent(ICommand command) { Command = command; } diff --git a/NzbDrone.Common/Messaging/MessageAggregator.cs b/NzbDrone.Common/Messaging/MessageAggregator.cs index 725f84ccf..59c831b71 100644 --- a/NzbDrone.Common/Messaging/MessageAggregator.cs +++ b/NzbDrone.Common/Messaging/MessageAggregator.cs @@ -60,7 +60,6 @@ public void PublishEvent(TEvent @event) where TEvent : class ,IEvent } } - private static string GetEventName(Type eventType) { if (!eventType.IsGenericType) @@ -71,7 +70,6 @@ private static string GetEventName(Type eventType) return string.Format("{0}<{1}>", eventType.Name.Remove(eventType.Name.IndexOf('`')), eventType.GetGenericArguments()[0].Name); } - public void PublishCommand(TCommand command) where TCommand : class, ICommand { Ensure.That(() => command).IsNotNull(); @@ -88,6 +86,7 @@ public void PublishCommand(TCommand command) where TCommand : class, I try { + PublishEvent(new CommandStartedEvent(command)); handler.Execute(command); sw.Stop(); PublishEvent(new CommandCompletedEvent(command));