【发布时间】:2017-08-17 16:49:18
【问题描述】:
我正在尝试将数据从 MainActivity 发送回 PCL 视图。当我发送没有数据的消息时,它会收到它。但是当我尝试用它传回一个字符串时,代码永远不会到达。
在 MainActivity 中:
if(data != null)
{
MessagingCenter.Send<object, string>(this, data, "MapIntentReceived");
MessagingCenter.Send<object>(this, "MapIntentReceived");
}
在 PCL 中:
MessagingCenter.Subscribe<object, string>(this, "MapIntentReceived",
async (sender, roomString) =>
{ //his code is not reached
await SearchForRooms(roomString);
});
MessagingCenter.Subscribe<object>(this, "MapIntentReceived",
async (sender) =>
{ //this code is reached
await SearchForRooms("blah");
});
感谢您的帮助。
【问题讨论】:
标签: xamarin xamarin.forms