com.jafarH.NotificationCenterNetCore
1.0.0
dotnet add package com.jafarH.NotificationCenterNetCore --version 1.0.0
NuGet\Install-Package com.jafarH.NotificationCenterNetCore -Version 1.0.0
<PackageReference Include="com.jafarH.NotificationCenterNetCore" Version="1.0.0" />
paket add com.jafarH.NotificationCenterNetCore --version 1.0.0
#r "nuget: com.jafarH.NotificationCenterNetCore, 1.0.0"
// Install com.jafarH.NotificationCenterNetCore as a Cake Addin #addin nuget:?package=com.jafarH.NotificationCenterNetCore&version=1.0.0 // Install com.jafarH.NotificationCenterNetCore as a Cake Tool #tool nuget:?package=com.jafarH.NotificationCenterNetCore&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 | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
-
.NETCoreApp 3.0
- com.JafarH.SerialDispatchQueue (>= 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 | 217 | 2/15/2023 |
First Release.