Created
June 7, 2014 17:01
-
-
Save Redth/e786c662c0283c291ca3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace Xamarin.Forms | |
| { | |
| public static class MessagingCenterEx | |
| { | |
| class MessagingCenterSender | |
| { | |
| public static MessagingCenterSender Instance = new MessagingCenterSender(); | |
| } | |
| public static void Send<TArgs> (TArgs args) | |
| { | |
| MessagingCenter.Send<MessagingCenterSender, TArgs> (MessagingCenterSender.Instance, string.Empty, args); | |
| } | |
| public static void Subscribe<TArgs> (object subscriber, Action<TArgs> received) | |
| { | |
| MessagingCenter.Subscribe<MessagingCenterSender, TArgs> (subscriber, string.Empty, (sender, args) => received(args)); | |
| } | |
| public static void Unsubscribe<TArgs> (object subscriber) | |
| { | |
| MessagingCenter.Unsubscribe <MessagingCenterSender, TArgs> (subscriber, string.Empty); | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment