/// <summary> /// Tells Publisher to publish event to all subscribers /// </summary> /// <param name="state"></param> protected virtual void HandlePublish(PublishEvent state) { // 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. Publisher?.Invoke(this, state); }
/// <summary> /// Publishes current state to event handler /// </summary> private void PublishState() { //Console.WriteLine("Publish: " + DateTime.Now.Second); //Console.WriteLine("publish"); var e = new PublishEvent(_objectDictionary, PlayerDictionary); HandlePublish(e); }