PCL: how to expose Navigation object to trigger navigation outside of Content Page

Hi!
I have a PCL project with web socket support. Each platform project has a specific web socket implementation. When i receive some specific messages on the web socket i want to trigger navigation on a new page in the Portable project from the platform specific project. How can i do that? It seems i need the Navigation object to switch to another Content page. Is there any way to expose the Navigation object so i can use it in the platform specific code? Or any other way for triggering navigation outside from a Content Page?

Thanks!

Tagged:

Posts

  • kentuckerkentucker USMember ✭✭✭✭

    I would make this app use either MVVMCross or MVVM light they both have navigation frameworks

  • revyrevy ITMember

    Thank you for the advice. Is there any good tutorial on how to integrate MVVMCross or MVVMlight navigation service in PCL portable project in Visual Studio?

  • revyrevy ITMember

    Thanks!

  • revyrevy ITMember

    I've just tried MVVM Light navigation in Xamarin.Forms. Navigation works as expected in the ViewModels, as the commands are trigger inside the UI thread. The problem is that i want to trigger navigation outside of the UI thread, because my websocket connection handlers work outside of the UI. I've tried with the following code:

    ServiceLocator.Current.GetInstance().NavigateTo(ViewModelLocator.SecondPage);

    but when this line of code is executed nothing happens. It seems that the MVVMLight DispatcherHelper can help to execute code in the UI thread from outside the UI, but unfortunately this helper seems not available in the PCL version of MVVMLight.

    Any other suggestion on how can i trigger navigation outside of UI?

  • BalaAKBalaAK INMember ✭✭

    any solution for this ???????????????

Sign In or Register to comment.