NavigationService won't navigate after going there via absolute Navigation - xamarin.forms

I am currently working on a Xamarin.Forms application that is targeting UWP, iOS and android.
After implementing a login dialog I am navigating a logged in user to a SomeContentPage, which I now want to be enclosed into a NavigationPage (and perhaps later on inside a MasterDetailPage).
I am trying to reset the navigation stack by using a /-prefix for a absolute navigation route, which will bring the user to the desired page and clear the stack:
await NavigationService.NavigateAsync("/NavigationPage/SomeContentPage");
Following, from this page there is no more relative navigation possible:
var navigationResult = await NavigationService.NavigateAsync("AnotherContentPage")
It seems like that there is everything going well "inside" the navigation system (navigationResult.Success is true) but the app is not navigating to the AnotherContentPage at all.
If I navigate without the /-Prefix, the upcoming navigation calls work as expected:
await NavigationService.NavigateAsync("NavigationPage/SomeContentPage");
I am really concerned and I already investigated very hard on this.
I don't know if I am just not understanding something properly in the Prism.Forms NavigationService concept or if I am trying something impossible here.
I re-read the Prism.Forms documentation, watched several YouTube-tutorials and read many blog posts about navigation in Prism.Forms.
I am near to desparation right now.
I really feel bad asking this and I am really questioning my internet-research-skills at this moment, but it would be great, if someone of you could give me some advice, how to handle this.
Thanks in advance and have a nice day!

Related

Prism detecting if page is modal programmatically and go back

I am implementing a feature using "connectivity" from essentials that when the app goes "offline" no wifi etc.. it navigates to a specific page.
It works in most cases however if I set the phone on "Airplane Mode" when I am on a modal page it does not navigate to my page.
In Prism is there a way to detect if the current page "IsModal" and either goback or kill it so that I can navigate to my specific Page?
THanks
You'd have to write some crazy lookup logic to figure it out. Unfortunately the helper for that doesn't currently exist. However the latest Prism 7.2 preview has some enhancements that specifically attempt to eliminate the need to figure out whether you require Modal Navigation and automatically use the proper type of Navigation. I would encourage you to try the preview. If you come up with a scenario where GoBack isn't working correctly please open an issue.

MasterDetail and NavigationPage deeplinking in Prism Forms

I am testing the deeplinking feature of the Prism Forms framework. I currently have a situation where I have a MasterDetailPage with a menu as Master. When I click the menu items, the Details should change to specific pages with a clean NavigationPage as container.
When I check the Sandbox example for Prism Forms, it shows an example for MasterDetail navigation, but not including navigation pages.
So I have this (absolute) deeplink structure at startup: /MasterDetailPage/NavigationPage/MyFirstPage
Then I want the second menu item to link to a fresh NavigationPage:
/MasterDetailPage/NavigationPage/MySecondPage
My current workaround is to do absolute deeplinking, but I was wondering if there is a better way? The Prism PageNavigationService checks to see if the segment type is the same as the current detail type. But since these are both NavigationPages, it tries to add the new page in the already existing NavigationPage. At that moment it also kills the menu-icon (at least on iOS).
Actually, the Sandbox app does use NavigationPages in the MasterDetail: https://github.com/PrismLibrary/Prism/blob/master/Sandbox/Xamarin/HelloWorld/HelloWorld/HelloWorld/Views/MyMasterDetail.xaml
Prism reuses the detail page for performance reasons, but it doesn't work like you think it does. While it does add the new page to the NavigationPage's NavigationStack, it also removes the previous page from the stack. This keeps the NavigationStack in the proper state.
The icon behavior you are seeing is because of a confirmed bug in Xamarin.Forms. You can follow the issue here: https://bugzilla.xamarin.com/show_bug.cgi?id=41038
As soon as Xamarin fixes this bug, I will publish the fix to Nuget. In the mean time, the only way to get around this is to fork the Prism code base and remove the Page type check.

debug Navigation stack, xamarin.forms

My little app was working, then I tried to change the navigation a little and now it crashes at
await Navigation.PopAsync();
I wonder if there is a way to be able to see the navigation stack, to know what would be expected when i do the Pop. I use PushAsync to get to this page, but since it crash here, I maybe screwed up somewhere else...
You have access to the Navigation Stack by calling Navigation.NavigationStack. If you want to know what is in there you could find the Type of each object within it.

How do I make a mobile-friendly popup on my website?

Is there a simple way to trigger a mobile OS's native pop-up/alert/etc. from some form of web code? I'm writing an ASP.NET mobile web page and I'd like to, for example, have the iPhone's UIAlertView appear.
EDIT: What I'm looking for is not the method with which to detect which mobile browser is accessing the site (I already know how to do that). If the code to trigger a pop-up that will look nice in an Android browser is different than the code to trigger a pop-up that will look nice in an iPhone browser, I can simply throw in a switch statement that redirects the user to the pop-up that corresponds with their browser. I'm trying to find the html/javascript/asp.net code which will create a mobile-friendly pop-up, either in general or for the various popular mobile web browsers specifically.
Don't know whether there is any pre-built functionality in .NET that can achieve this, but you can surely write one yourself.
You can write a method, that returns the code for your popup, based on the user OS (simple switch statement should do).
EDIT after taking a short nap:
I believe you should reconsider using popups. They are quite annoying even on desktop browsers and many people block them automatically. Probably every blog about accessibility will tell you, that you should keep mobile version of your website as simple as possible because of various compatibility issues that you can run into.
Instead, try to think about some interesting way to incorporate messages for users in a different and appealing way, that won't disturb anybody.
What I do is use a div popup (that floats ontop of the page) and eighter make a big close button or set at timeout to remove it.
jquery mobile is a good place to start.

TV ergonomics in Flex

Im having fun toying with AIR and want to use it to create an application for my TV, but Im coping with a serious & dumb problem : TV ergonomics. Indeed, without a mouse, it is all about focus on elements and moving this focus in a natural fashion.
In HTML this is handled by the browsers perfectly, but in ActionScript Im having a real hard time ! For instance, I don't even know how to have an element on autofocus, so that when I load the app there is already something to click on (without it I just can't interact with my app at all!).
Do you have any idea on the best ways to create a listener for the remote controller arrows and OK button (should be enough) so that I never get stuck in the app ?
So whether you have already struggled with that or if you simply happen to know how to play with the focus and setFocus() parts of Flex, your help is very welcome !
I recommend you look at the Google TV Flash template. It's all about controls and navigation. I'm not sure if this works for Flex as I have not done any gtv development yet.

Resources