New projects on Event Aggregation


Loosely coupled design with event aggregation

Description

Event Aggregator aggregates events from multiple objects into itself, passing that same event onto its observers.

Simple

You can fire up any type of event.

App.xaml.cs
using System.Windows;
using EventAggregator;

namespace EventAggregatorSample
{
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Current.MainWindow = new MainWindow();

            this.Send(EventId.Default.AppStartup);
        }
    }
}

Handle fired event whenever you need.

MainWindow.xaml.cs
using System.Windows;
using EventAggregator;

namespace EventAggregatorSample
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.Subscribe(EventId.Default.AppStartup, HandleAppStartup);
        }

        private void HandleAppStartup(EventMessage eventMessage)
        {
            Show();
        }
    }
}

It is simple and makes no couplings between modules.

Performance

It is very fast.
Single event processing takes 25-30 μs depending on the system.
See performance test results.

Last edited Aug 20, 2013 at 7:31 PM by timothy_makarov, version 31