public void FireAfterVoteMade(object sender, VoteEventArgs eventArgs) { var handler = AfterVoteMade; if (handler != null) { handler(this, eventArgs); } }
/// <summary> /// Add a new vote /// </summary> /// <param name="vote"></param> /// <returns></returns> public Vote Add(Vote vote) { var e = new VoteEventArgs {Vote = vote, Api = _api}; EventManager.Instance.FireBeforeVoteMade(this, e); if (!e.Cancel) { _voteRepository.Add(vote); EventManager.Instance.FireAfterVoteMade(this, new VoteEventArgs {Vote = vote, Api = _api}); } return vote; }
/// <summary> /// Add a new vote /// </summary> /// <param name="vote"></param> /// <returns></returns> public Vote Add(Vote vote) { var e = new VoteEventArgs {Vote = vote}; EventManager.Instance.FireBeforeVoteMade(this, e); if (!e.Cancel) { _context.Vote.Add(vote); EventManager.Instance.FireAfterVoteMade(this, new VoteEventArgs {Vote = vote}); } return vote; }
private void EventManagerInstanceAfterVoteMade(object sender, VoteEventArgs args) { _eventTestStr = TestString; }
private void EventManagerInstanceBeforeVoteMadeCancel(object sender, VoteEventArgs args) { args.Cancel = true; }
private void EventManagerInstanceBeforeVoteMadeAllow(object sender, VoteEventArgs args) { args.Cancel = false; }
public void FireBeforeVoteMade(object sender, VoteEventArgs eventArgs) { var handler = BeforeVoteMade; if (handler != null) { handler(this, eventArgs); } }