protected override void OnStart() { if (!IsRunning) { _commentSubmitToken = Subscribe <CommentSubmitEvent, CommentSubmitEventArgs>(CommentSubmitted); _commentMarkAsOffendedToken = Subscribe <CommentMarkAsOffendedEvent, CommentMarkAsOffendedEventArgs>(CommentMarkedAsOffended); _commentSpamToken = Subscribe <CommentSpamEvent, CommentSpamEventArgs>(CommentSpammed); _storyApproveToken = Subscribe <StoryApproveEvent, StoryApproveEventArgs>(StoryApproved); _storyDeleteToken = Subscribe <StoryDeleteEvent, StoryDeleteEventArgs>(StoryDeleted); _storyMarkAsSpamToken = Subscribe <StoryMarkAsSpamEvent, StoryMarkAsSpamEventArgs>(StoryMarkedAsSpam); _storySpamToken = Subscribe <StorySpamEvent, StorySpamEventArgs>(StorySpammed); _storyPublishToken = Subscribe <StoryPublishEvent, StoryPublishEventArgs>(StoryPublished); _possibleStorySpamToken = Subscribe <PossibleSpamStoryEvent, PossibleSpamStoryEventArgs>(PossibleSpamStoryDetected); _possibleCommentSpamToken = Subscribe <PossibleSpamCommentEvent, PossibleSpamCommentEventArgs>(PossibleSpamCommentDetected); } }
protected internal void Unsubscribe <TEvent>(SubscriptionToken token) where TEvent : BaseEvent { _eventAggregator.GetEvent <TEvent>().Unsubscribe(token); }