我正在尝试将数据从 MainActivity 发送回 PCL 视图。当我发送一条没有数据的消息时,它会收到它。但是当我尝试用它传回一个字符串时,代码永远不会到达。
在主要活动中:
if(data != null)
{
MessagingCenter.Send<object, string>(this, data, "MapIntentReceived");
MessagingCenter.Send<object>(this, "MapIntentReceived");
}
Run Code Online (Sandbox Code Playgroud)
在 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");
});
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助。
如何从xamarin表单中的客户端项目将一个内容页面导航到另一个内容页面?
我已经以不同的方式在每个平台上实现了推送通知.我需要导航到当前内容页面中的其他内容.
我尝试在GCMService的OnMessage方法中使用下面的代码.我的问题是第二个导航内容页面的构造函数被调用并成功调试.但我的屏幕仍然显示当前页面不显示第二个导航内容页面.
App.Current.MainPage.Navigation.PushAsync (new SecondNavigationContentPage());
Run Code Online (Sandbox Code Playgroud) 我已经创建了一个简单的WCF应用程序,我在我的服务中添加了一个显示方法,但我不知道如何测试这个显示服务?我使用谷歌进行了搜索,但没有找到任何可行的解决方案.