File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 11# NotificationCenter [ ![ Build Status] ( https://travis-ci.org/Husseinhj/NotificationCenter.svg?branch=master )] ( https://travis-ci.org/Husseinhj/NotificationCenter ) ![ Nuget version] ( https://img.shields.io/nuget/v/NotificationCenter.svg?style=flat ) ![ downloads] ( https://img.shields.io/nuget/dt/NotificationCenter.svg?style=flat )
22This library works like Objective-C and Swift NSNotificationCenter.
3+
4+ ## Installation
5+ Use this command in Nuget Package Manager Console:
6+
7+ ``` ruby
8+ PM > Install - Package NotificationCenter - Version 1.0 .0
9+ ```
10+
11+ ## Methods
12+ ### Subscribe
13+ To add an action with Key in NotificationCenter, You should use this code :
14+
15+ ``` csharp
16+ NotificationCenter .Subscribe (" KEY" ,Action );
17+
18+ private void Action ()
19+ {
20+ Debug .WriteLine (" Action was run" );
21+ }
22+
23+ // or
24+ NotificationCenter .Subscribe (" KEY" ,Action );
25+
26+ private void Action (object o )
27+ {
28+ Debug .WriteLine (" Action was run with {0} object" ,o );
29+ }
30+ ```
31+
32+ ### Unsubscribe
33+ To remove your action in NotificationCenter, You should use this code :
34+
35+ ``` csharp
36+ NotificationCenter .Unsubscribe (" KEY" );
37+ ```
38+
39+ ### Notify
40+ To invoke or notify all actions in unique Key, You should use this code :
41+
42+ ``` csharp
43+ NotificationCenter .Notify (key : " KEY" ,data : 5 );
44+ ```
45+
46+ ### KeepActionValue property
47+ Keep action data if key was not subscribed yet. It just work in Notify with data.
You can’t perform that action at this time.
0 commit comments