NotificationCenterNetFramework 1.0.0
dotnet add package NotificationCenterNetFramework --version 1.0.0
NuGet\Install-Package NotificationCenterNetFramework -Version 1.0.0
<PackageReference Include="NotificationCenterNetFramework" Version="1.0.0" />
paket add NotificationCenterNetFramework --version 1.0.0
#r "nuget: NotificationCenterNetFramework, 1.0.0"
// Install NotificationCenterNetFramework as a Cake Addin #addin nuget:?package=NotificationCenterNetFramework&version=1.0.0 // Install NotificationCenterNetFramework as a Cake Tool #tool nuget:?package=NotificationCenterNetFramework&version=1.0.0
NotificationCenter
A communication path between all classes of a project using the notification center. Transferring data between observers at high speed and completely asynchronously. Implemented similarly to "NotificationCenter" in Swift.
Dependencies
Usage
The class that is going to be an observer of the notifications must implement the "Notifiable" interface:
public class Observer: Notifiable
{
public void OnNotification(Notification notification)
{
Console.WriteLine(notification.ToString());
}
}
A class must be a member of the Notification Center observers to receive notifications:
private NotificationName notifName;
public Observer()
{
notifName = new NotificationName("DefaultName");
NotificationCenter.Default.AddObserver(this, notifName);
}
A class can be an observer of different names. Each notification name is a separate list of observers. It means that a class receives a notification when another class sends a notification with the same name.
To post a notification:
NotificationCenter.Default.Post(sender: this, name: notifName, obj: "Hey there!", userInfo: null);
The main notification data has two parts:
- Object: which can carry any type of data
- UserInfo: includes a dictionary of keys and desired values
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- SerialDispatchQueueDotNetFramework (>= 1.0.0)
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.0.0 | 639 | 2/10/2023 |
First Release