1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 09:49:00 +00:00

Added CommandStartedEvent

This commit is contained in:
Mark McDowall 2013-08-27 17:54:26 -07:00
parent a3961ffb69
commit a86c131761
3 changed files with 15 additions and 4 deletions

View file

@ -0,0 +1,12 @@
namespace NzbDrone.Common.Messaging
{
public class CommandExecutedEvent : IEvent
{
public ICommand Command { get; private set; }
public CommandExecutedEvent(ICommand command)
{
Command = command;
}
}
}

View file

@ -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;
}

View file

@ -60,7 +60,6 @@ public void PublishEvent<TEvent>(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>(TCommand command) where TCommand : class, ICommand
{
Ensure.That(() => command).IsNotNull();
@ -88,6 +86,7 @@ public void PublishCommand<TCommand>(TCommand command) where TCommand : class, I
try
{
PublishEvent(new CommandStartedEvent(command));
handler.Execute(command);
sw.Stop();
PublishEvent(new CommandCompletedEvent(command));