using System; using System.Diagnostics; namespace NJDOTNET.Trivia { /// /// This is a basic IGameClient implementation that just does /// the bare minimum to qualify as a client (with some logging). /// /// /// This is a real nice candidate for a base class! /// public class SimpleGameClient : IGameClient { public event EventHandler> OnGameEnd; public event EventHandler> OnGameStart; public event EventHandler> OnQuestionChanged; public virtual void HandleGameStart(Game game) { Debug.WriteLine("HandleGameStart"); if (OnGameStart != null) OnGameStart(this, new EventArgs(game)); } public virtual void HandleGameEnd(GameSummary summary) { Debug.WriteLine("HandleGameEnd"); if (OnGameEnd != null) OnGameEnd(this, new EventArgs(summary)); } public virtual void HandleQuestionChanged(Question question) { Debug.WriteLine("HandleQuestionChanged"); if (OnQuestionChanged != null) OnQuestionChanged(this, new EventArgs(question)); } } }