示例#1
0
 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);
     }
 }
示例#2
0
 protected internal void Unsubscribe <TEvent>(SubscriptionToken token) where TEvent : BaseEvent
 {
     _eventAggregator.GetEvent <TEvent>().Unsubscribe(token);
 }