/// <summary> /// Timer callback delegate. /// </summary> /// <param name="state">The state.</param> private void TimerCallback(object state) { // Every second alternately publish one of our two event types. ISignalREvent myEvent; if (_flip) { myEvent = new SimpleEvent { MessageText = string.Format("Server says hi at {0}", DateTime.Now) }; } else { var employee = new Employee { Name = "John Smith", BirthDate = DateTime.Today }; myEvent = new ComplexEvent { Employee = employee, Timestamp = DateTime.Now }; } // Publish the event via Prism's event aggregator (horrible syntax!) _prismEventAggregator.GetEvent<PubSubEvent<ISignalREvent>>().Publish(myEvent); _flip = !_flip; }
/// <summary> /// Subscribes to SimpleEvents. /// </summary> /// <param name="simpleEvent">The event.</param> private static void SimpleEventSubscriber(SimpleEvent simpleEvent) { Console.WriteLine("Simple event. Message text: {0}", simpleEvent.MessageText); Console.WriteLine(); }