├── NotificationCenter
├── nuget
│ ├── pack.cmd
│ ├── nuget.exe
│ └── NotificationCenter.nuspec
├── Properties
│ └── AssemblyInfo.cs
├── NotificationCenter.csproj
└── NotificationCenter.cs
├── NotificationCenter.Test.UWP
├── Assets
│ ├── StoreLogo.png
│ ├── SplashScreen.scale-200.png
│ ├── LockScreenLogo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Wide310x150Logo.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ └── Square44x44Logo.targetsize-24_altform-unplated.png
├── App.xaml
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── MainPage.xaml
├── Package.appxmanifest
├── MainPage.xaml.cs
├── App.xaml.cs
└── NotificationCenter.Test.UWP.csproj
├── NotificationCenter.Sample.iOS
├── Resources
│ ├── Default.png
│ ├── Default@2x.png
│ ├── Default-568h@2x.png
│ ├── Default-Portrait.png
│ ├── Default-Portrait@2x.png
│ └── LaunchScreen.storyboard
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Icon1024.png
│ │ ├── Icon120.png
│ │ ├── Icon152.png
│ │ ├── Icon167.png
│ │ ├── Icon180.png
│ │ ├── Icon20.png
│ │ ├── Icon29.png
│ │ ├── Icon40.png
│ │ ├── Icon58.png
│ │ ├── Icon60.png
│ │ ├── Icon76.png
│ │ ├── Icon80.png
│ │ ├── Icon87.png
│ │ └── Contents.json
├── Entitlements.plist
├── Main.cs
├── AppDelegate.cs
├── Info.plist
├── Properties
│ └── AssemblyInfo.cs
└── NotificationCenter.Sample.iOS.csproj
├── NotificationCenter.Sample.Android
├── Resources
│ ├── mipmap-hdpi
│ │ ├── Icon.png
│ │ └── launcher_foreground.png
│ ├── mipmap-mdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ ├── mipmap-xhdpi
│ │ ├── Icon.png
│ │ └── launcher_foreground.png
│ ├── mipmap-xxhdpi
│ │ ├── Icon.png
│ │ └── launcher_foreground.png
│ ├── mipmap-xxxhdpi
│ │ ├── Icon.png
│ │ └── launcher_foreground.png
│ ├── mipmap-anydpi-v26
│ │ ├── icon.xml
│ │ └── icon_round.xml
│ ├── values
│ │ ├── colors.xml
│ │ └── styles.xml
│ ├── layout
│ │ ├── Toolbar.axml
│ │ └── Tabbar.axml
│ └── AboutResources.txt
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
├── Assets
│ └── AboutAssets.txt
├── MainActivity.cs
└── NotificationCenter.Sample.Android.csproj
├── NotificationCenter.Sample
├── App.xaml
├── NotificationCenter.Sample.csproj
├── App.xaml.cs
├── MainPage.xaml
└── MainPage.xaml.cs
├── .travis.yml
├── README.md
├── .gitattributes
├── .gitignore
└── NotificationCenter.sln
/NotificationCenter/nuget/pack.cmd:
--------------------------------------------------------------------------------
1 | nuget pack .../NotificationCenter.csproj
--------------------------------------------------------------------------------
/NotificationCenter/nuget/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter/nuget/nuget.exe
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Resources/Default.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Resources/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Resources/Default@2x.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Resources/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Resources/Default-Portrait.png
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-hdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-hdpi/Icon.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-mdpi/icon.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Resources/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Resources/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-xhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-xhdpi/Icon.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-xxhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-xxhdpi/Icon.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Husseinhj/NotificationCenter/HEAD/NotificationCenter.Test.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #3F51B5
5 | #303F9F
6 | #FF4081
7 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: csharp
2 | solution: NotificationCenter/NotificationCenter.csproj
3 | before_install:
4 | - mkdir -p .nuget
5 | - wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
6 | - mono .nuget/nuget.exe # Output NuGet's version number
7 | install:
8 | - sudo apt-get install -y gtk-sharp2
9 | - mono .nuget/nuget.exe restore NotificationCenter/NotificationCenter.csproj
10 | mono:
11 | - latest
12 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace NotificationCenter.Sample.iOS
9 | {
10 | public class Application
11 | {
12 | // This is the main entry point of the application.
13 | static void Main(string[] args)
14 | {
15 | // if you want to use a different Application Delegate class from "AppDelegate"
16 | // you can specify it here.
17 | UIApplication.Main(args, null, "AppDelegate");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample/NotificationCenter.Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 | pdbonly
9 | true
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with you package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 | using Xamarin.Forms.Xaml;
4 |
5 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
6 | namespace NotificationCenter.Sample
7 | {
8 | public partial class App : Application
9 | {
10 | public App()
11 | {
12 | InitializeComponent();
13 |
14 | MainPage = new NavigationPage(new MainPage());
15 | }
16 |
17 | protected override void OnStart()
18 | {
19 | // Handle when your app starts
20 | }
21 |
22 | protected override void OnSleep()
23 | {
24 | // Handle when your app sleeps
25 | }
26 |
27 | protected override void OnResume()
28 | {
29 | // Handle when your app resumes
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Android.App;
4 | using Android.Content.PM;
5 | using Android.Runtime;
6 | using Android.Views;
7 | using Android.Widget;
8 | using Android.OS;
9 |
10 | namespace NotificationCenter.Sample.Droid
11 | {
12 | [Activity(Label = "NotificationCenter.Sample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
13 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
14 | {
15 | protected override void OnCreate(Bundle savedInstanceState)
16 | {
17 | TabLayoutResource = Resource.Layout.Tabbar;
18 | ToolbarResource = Resource.Layout.Toolbar;
19 |
20 | base.OnCreate(savedInstanceState);
21 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
22 | LoadApplication(new App());
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/NotificationCenter/nuget/NotificationCenter.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NotificationCenter
5 | 1.0.3
6 | NotificationCenter
7 | Hussein.Juybari
8 | Hussein.Juybari
9 | https://github.com/Husseinhj/NotificationCenter
10 | false
11 | This library works like Objective-C and Swift NSNotificationCenter
12 | Copyright © 2017
13 | NotificationCenter, NSNotificationCenter, UWP, Xamarin, windows phone, PCL, iOS, Android
14 |
15 |
16 |
17 | # 1.0.3
18 | - Notify actions as parallel
19 |
20 | # 1.0.2
21 | - Add UnsubscribeAll method
22 | - Throw exception when arguments was null
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("NotificationCenter.Test.UWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("NotificationCenter.Test.UWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace NotificationCenter.Sample.iOS
9 | {
10 | // The UIApplicationDelegate for the application. This class is responsible for launching the
11 | // User Interface of the application, as well as listening (and optionally responding) to
12 | // application events from iOS.
13 | [Register("AppDelegate")]
14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
15 | {
16 | //
17 | // This method is invoked when the application has loaded and is ready to run. In this
18 | // method you should instantiate the window, load the UI into it and then make the window
19 | // visible.
20 | //
21 | // You have 17 seconds to return from this method, or iOS will terminate your application.
22 | //
23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
24 | {
25 | global::Xamarin.Forms.Forms.Init();
26 | LoadApplication(new App());
27 |
28 | return base.FinishedLaunching(app, options);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/NotificationCenter/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("NotificationCenter")]
10 | [assembly: AssemblyDescription("This library works like Objective-C and Swift NSNotificationCenter")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("Hussein.Juybari")]
13 | [assembly: AssemblyProduct("NotificationCenter")]
14 | [assembly: AssemblyCopyright("Copyright © 2018")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: NeutralResourcesLanguage("en")]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.3.0")]
30 | [assembly: AssemblyFileVersion("1.0.3.0")]
31 |
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
16 |
23 |
24 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("NotificationCenter.Sample.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("NotificationCenter.Sample.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2014")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
32 | // Add some common permissions, these can be removed if not needed
33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
35 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UISupportedInterfaceOrientations
11 |
12 | UIInterfaceOrientationPortrait
13 | UIInterfaceOrientationLandscapeLeft
14 | UIInterfaceOrientationLandscapeRight
15 |
16 | UISupportedInterfaceOrientations~ipad
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationPortraitUpsideDown
20 | UIInterfaceOrientationLandscapeLeft
21 | UIInterfaceOrientationLandscapeRight
22 |
23 | MinimumOSVersion
24 | 8.0
25 | CFBundleDisplayName
26 | NotificationCenter.Sample
27 | CFBundleIdentifier
28 | io.husseinhj.NotificationCenter-Sample
29 | CFBundleVersion
30 | 1.0
31 | UILaunchStoryboardName
32 | LaunchScreen
33 | CFBundleName
34 | NotificationCenter.Sample
35 | XSAppIconAssets
36 | Assets.xcassets/AppIcon.appiconset
37 |
38 |
39 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
24 |
27 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("NotificationCenter.Sample.iOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("NotificationCenter.Sample.iOS")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | NotificationCenter.Test.UWP
18 | ADP
19 | Assets\StoreLogo.png
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.Android/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
51 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NotificationCenter [](https://travis-ci.org/Husseinhj/NotificationCenter)  
2 | A notification dispatch mechanism that enables the broadcast of information to registered observers. This library works like **Objective-C** and **Swift** `NSNotificationCenter` also like `BroadcastReceiver` in **Android** platform.
3 | A notification dispatch mechanism that enables the broadcast of information to registered observers.
4 |
5 | ## Articles
6 | - Read [our tutorial or article](https://medium.com/@hussein.juybari/nsnotificationcenter-broadcastreceiver-in-c-net-4ad677c7be73) in Medium website.
7 | - Read [article](http://www.c-sharpcorner.com/article/nsnotificationcenter-broadcastreceiver-in-c-sharp-net/) in C# corner website.
8 | - Read [article](https://www.linkedin.com/pulse/nsnotificationcenter-broadcastreceiver-c-net-hussein-habibi-juybari) in Linked-in website.
9 | ## Installation
10 | Use this command in Nuget Package Manager Console:
11 |
12 | ```
13 | PM> Install-Package NotificationCenter
14 | ```
15 |
16 | ## Methods
17 | ### Subscribe
18 | To add an action with Key in NotificationCenter, You should use this code :
19 |
20 | ``` csharp
21 | NotificationCenter.Subscribe("KEY",Action);
22 |
23 | private void Action()
24 | {
25 | Debug.WriteLine("Action was run");
26 | }
27 |
28 | // or
29 | NotificationCenter.Subscribe("KEY",Action);
30 |
31 | private void Action(object o)
32 | {
33 | Debug.WriteLine("Action was run with {0} object",o);
34 | }
35 | ```
36 |
37 | ### Unsubscribe
38 | To remove your action in NotificationCenter, You should use this code :
39 |
40 | ``` csharp
41 | NotificationCenter.Unsubscribe("KEY");
42 | ```
43 |
44 | or Remove all subscribers use :
45 |
46 | ``` csharp
47 | NotificationCenter.UnsubscribeAll();
48 | ```
49 |
50 | ### Notify
51 | To invoke or notify all actions in unique Key, You should use this code :
52 |
53 | ``` csharp
54 | NotificationCenter.Notify(key: "KEY",data: 5);
55 | ```
56 |
57 | ### KeepActionValue property
58 | Keep action data if key was not subscribed yet. It just work in Notify with data.
59 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 |
4 | namespace NotificationCenter.Sample
5 | {
6 | public partial class MainPage : ContentPage
7 | {
8 | public MainPage()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | #region Event method
14 |
15 | void Subscribe_Clicked(object sender, EventArgs e)
16 | {
17 | String actionName = txtSubscribeAction.Text;
18 | if (!String.IsNullOrEmpty(actionName))
19 | {
20 | NotificationCenter.Subscribe(actionName, (obj) =>
21 | {
22 | Device.BeginInvokeOnMainThread(() =>
23 | {
24 | txtLog.Text = txtLog.Text + $"\nAction {actionName} notified. Object is {obj.ToString()}";
25 | });
26 | });
27 | }
28 | else
29 | {
30 | DisplayAlert("Error", "Subscribe action name is null or empty. Please, provide an action name", "OK");
31 | }
32 | }
33 |
34 | void Unsubscribe_Clicked(object sender, EventArgs e)
35 | {
36 | String actionName = txtUnsubscribeAction.Text;
37 | if (!String.IsNullOrEmpty(actionName))
38 | {
39 | NotificationCenter.Unsubscribe(actionName);
40 | txtLog.Text = txtLog.Text + $"\nUnsubscribe {actionName}";
41 | }
42 | else
43 | {
44 | DisplayAlert("Error", "Unsubscribe action name is null or empty. Please, provide an action name", "OK");
45 | }
46 | }
47 |
48 | async void Notify_Clicked(object sender, EventArgs e)
49 | {
50 | String actionName = txtNotifyAction.Text;
51 | if (!String.IsNullOrEmpty(actionName))
52 | {
53 | var obj = new {action = actionName};
54 |
55 | await NotificationCenter.Notify(actionName, obj);
56 | txtLog.Text = txtLog.Text + $"\nNotify action {actionName}";
57 | }
58 | else
59 | {
60 | await DisplayAlert("Error", "Subscribe action name is null or empty. Please, provide an action name", "OK");
61 | }
62 | }
63 |
64 | #endregion
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Resources/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/NotificationCenter.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "scale": "2x",
5 | "size": "20x20",
6 | "idiom": "iphone",
7 | "filename": "Icon40.png"
8 | },
9 | {
10 | "scale": "3x",
11 | "size": "20x20",
12 | "idiom": "iphone",
13 | "filename": "Icon60.png"
14 | },
15 | {
16 | "scale": "2x",
17 | "size": "29x29",
18 | "idiom": "iphone",
19 | "filename": "Icon58.png"
20 | },
21 | {
22 | "scale": "3x",
23 | "size": "29x29",
24 | "idiom": "iphone",
25 | "filename": "Icon87.png"
26 | },
27 | {
28 | "scale": "2x",
29 | "size": "40x40",
30 | "idiom": "iphone",
31 | "filename": "Icon80.png"
32 | },
33 | {
34 | "scale": "3x",
35 | "size": "40x40",
36 | "idiom": "iphone",
37 | "filename": "Icon120.png"
38 | },
39 | {
40 | "scale": "2x",
41 | "size": "60x60",
42 | "idiom": "iphone",
43 | "filename": "Icon120.png"
44 | },
45 | {
46 | "scale": "3x",
47 | "size": "60x60",
48 | "idiom": "iphone",
49 | "filename": "Icon180.png"
50 | },
51 | {
52 | "scale": "1x",
53 | "size": "20x20",
54 | "idiom": "ipad",
55 | "filename": "Icon20.png"
56 | },
57 | {
58 | "scale": "2x",
59 | "size": "20x20",
60 | "idiom": "ipad",
61 | "filename": "Icon40.png"
62 | },
63 | {
64 | "scale": "1x",
65 | "size": "29x29",
66 | "idiom": "ipad",
67 | "filename": "Icon29.png"
68 | },
69 | {
70 | "scale": "2x",
71 | "size": "29x29",
72 | "idiom": "ipad",
73 | "filename": "Icon58.png"
74 | },
75 | {
76 | "scale": "1x",
77 | "size": "40x40",
78 | "idiom": "ipad",
79 | "filename": "Icon40.png"
80 | },
81 | {
82 | "scale": "2x",
83 | "size": "40x40",
84 | "idiom": "ipad",
85 | "filename": "Icon80.png"
86 | },
87 | {
88 | "scale": "1x",
89 | "size": "76x76",
90 | "idiom": "ipad",
91 | "filename": "Icon76.png"
92 | },
93 | {
94 | "scale": "2x",
95 | "size": "76x76",
96 | "idiom": "ipad",
97 | "filename": "Icon152.png"
98 | },
99 | {
100 | "scale": "2x",
101 | "size": "83.5x83.5",
102 | "idiom": "ipad",
103 | "filename": "Icon167.png"
104 | },
105 | {
106 | "scale": "1x",
107 | "size": "1024x1024",
108 | "idiom": "ios-marketing",
109 | "filename": "Icon1024.png"
110 | }
111 | ],
112 | "properties": {},
113 | "info": {
114 | "version": 1,
115 | "author": "xcode"
116 | }
117 | }
--------------------------------------------------------------------------------
/NotificationCenter.Test.UWP/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices.WindowsRuntime;
7 | using Windows.ApplicationModel.Core;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Core;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
20 |
21 | namespace NotificationCenter.Test.UWP
22 | {
23 | ///
24 | /// An empty page that can be used on its own or navigated to within a Frame.
25 | ///
26 | public sealed partial class MainPage : Page
27 | {
28 | public MainPage()
29 | {
30 | this.InitializeComponent();
31 | }
32 |
33 | private async void Action(object o)
34 | {
35 | if (o != null)
36 | {
37 | if (o is List