Build Model:
public class LoginMessage : MvxMessage
{
public LoginMessage(object sender, string userName)
: base(sender)
{
UserName = userName;
}
public string UserName { get; private set; }
}
Send Message:
LoginMessage message = new LoginMessage(this, UserName);
Mvx.Resolve<IMvxMessenger>().Publish(message);
Receive Message:
private MvxSubscriptionToken _token;
_token = Mvx.Resolve<IMvxMessenger>().Subscribe<LoginMessage>(OnLoginMessage);
private void OnLoginMessage(LoginMessage loginMessage)
{
txtUserName.Text = loginMessage.UserName;
}