Created
October 1, 2017 17:33
-
-
Save tomwis/8a1460c5f5acffb170fc09f25f52f935 to your computer and use it in GitHub Desktop.
This file contains 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
public class MyMessage { } | |
public class DashboardViewModel : ViewModelBase | |
{ | |
public DashboardViewModel() | |
{ | |
MessengerInstance.Register<MyMessage>(this, OnMyMessage); | |
// lub MessengerInstance.Register<MyMessage>(this, "myToken", OnMyMessage); | |
} | |
private void OnMyMessage(MyMessage obj) | |
{ | |
// ... | |
} | |
} | |
public class OtherViewModel : ViewModelBase | |
{ | |
public void SomeMethod() | |
{ | |
MessengerInstance.Send(new MyMessage()); | |
// MessengerInstance.Send<MyMessage, DashboardViewModel>(new MyMessage()); // dla konkretnego odbiorcy | |
// MessengerInstance.Send<MyMessage>(new MyMessage(), "myToken"); // wiadomość otrzymają tylko subskrybenci z takim samym tokenem | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment