public void AgentCandidateChanged(Object sender, CandidateEventArgs e) { if (registeredAgent != null) { Invoke(new Action(() => { PrepareCandidatesCB(registeredAgent); })); } }
protected virtual void OnCandidateChanged(CandidateEventArgs e){ // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. EventHandler<CandidateEventArgs> handler = CandidateChanged; if (handler != null) { handler(this, e); } }