MPowerKit.Events 1.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package MPowerKit.Events --version 1.0.2
                    
NuGet\Install-Package MPowerKit.Events -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MPowerKit.Events" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MPowerKit.Events" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="MPowerKit.Events" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MPowerKit.Events --version 1.0.2
                    
#r "nuget: MPowerKit.Events, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MPowerKit.Events&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=MPowerKit.Events&version=1.0.2
                    
Install as a Cake Tool

MPowerKit.Events

This library gives you an ability to facilitate communication between loosely coupled components in an application.

NuGet

Inspired by Prism's EventAggregator.

Note: Main difference from Prism is that this library does not support different threads event publishing/handling. The event will be handled in that thread it was raised in. Also, code was refactored to use latest .net and c# features.

Usage

Register event aggregator in service collection:

serviceCollection.AddSingleton<IEventAggregator, EventAggregator>();

or use as singleton

EventAggregator.Current.GetEvent<>()

Create an event:

public class SomeEvent : PubSubEvent { }

or generic version

public class SomeGenericEvent : PubSubEvent<payload_type> { }

Subscribe to an event:

IEventAggregator _eventAggregator;

public void EventHandler() { }

_eventAggregator.GetEvent<SomeEvent>().Subscribe(EventHandler);

public void GenericEventHandler(payload_type payload) { }

_eventAggregator.GetEvent<SomeGenericEvent>().Subscribe(GenericEventHandler);

Publish an event:

IEventAggregator _eventAggregator;

_eventAggregator.GetEvent<SomeEvent>().Publish();

_eventAggregator.GetEvent<SomeGenericEvent>().Publish(payload);

Note: you may not unsubscribe from events, because it has weak reference, but better to do unsubscribe

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 181 6/18/2025
1.1.0 141 6/16/2025
1.0.2 831 12/29/2023
1.0.1 417 12/15/2023
1.0.0 533 12/13/2023