Why doesn't GoBackAsync() fire on OnNavigatedTo() method of previous page? - c#

I have two pages pageA and pageB.
When I navigate from pageA to pageB and later execute _navigationService.GoBackAsync(), it works correctly and it navigates me to pageA.
But, OnNavigatedTo() and OnNavigatingTo() in pageA doesn't seem to execute (that I can tell?). PageA is a tabbedPage and I'm using Xamarin forms and Prism 7.
I'm testing it on iPhone.
What could I be doing incorrectly?

That (what you have) should work. You have found a bug.
Please submit your issue to the Prism GitHub site and provide as much information as possible as well as a sample app that reproduces the issue.

Related

How to create tabbed page in Xamarin.Forms similar to that of Facebook app

I am working with Xamarin.Forms and I would like to create a navigation method similar to that of the Facebook app and also other newer versions of different apps. Here are two pictures, one of Facebook app on Android and the other is of KakaoTalk, also on Android.
I've tried several different ways to implement this. For example I wrapped the MainPage (TabbedPage) inside a NavigationPage. I also tried wrapping the MainPage (ContentPage) inside a NavigationPage then calling
PushAsync(new TabbedPage());
inside the MainPage via the Navigation property. I also tried wrapping the children of the MainPage (TabbedPage) inside separate NavigationPages. None of these attempts resulted in the desired effect.
I would like the following to happen. When a user taps on a Button or something that navigates to another page I'd like a ContentPage to pop in front of everything (tab bar included) except for the Navigation bar (or Action Bar). Obviously this happens via the PushAsync() method which also results in a small back arrow appearing in the Nav bar. My understanding is that a PushAsync() call pushes the chosen page onto the navigation stack provided by the NavigationPage. Therefore if a TabbedPage is wrapped inside a NavigationPage a new ContentPage would not be able to pop in front of the tabs like in the two applications mentioned above.
This, plus the fact that the tab bars of said apps don't get inside the ActionBar (in Android) in landscape mode leads me to believe that what I'm trying to achieve is best done not using TabbedPage but something that acts like a tab bar, e.g. a horizontal stack of Buttons perhaps.
Has anyone implemented this correctly and in an elegant way using Xamarin.Forms? So again, I would like to make this tab like navigation with the tabs staying underneath the ActionBar in landscape mode and a new Page appearing in front of the tabs (hiding them) when pushed onto the navigation stack. Do you think this can be done with Custom Renderers? Of course in iOS these are done with tabs but in Android I'm not sure.
What I would like is not necessarily code examples, but a best practice on this issue. So again, this is in Xamarin.Forms with a common PCL project and an Android and iOS project. Thank you in advance for your answers and advices!
P.S.: I've obviously searched this site before (Google as well) but I've found no real articles on this issue.
I have used ToolbarItems order=primary for navigation bar menu button and ToolbarItems order=secondary for tab bar on top.I have PCL the code written is in XAML. :)
http://codeworks.it/blog/?p=232
My understanding is that a PushAsync() call pushes the chosen page onto the navigation stack provided by the NavigationPage. Therefore if a TabbedPage is wrapped inside a NavigationPage a new ContentPage would not be able to pop in front of the tabs like in the two applications mentioned above.
This is not true actually. According to Xamarin API Doc, the Navigation property is context-aware, i.e. it will find all its parents until there is a NavigationPage.
In Android, only one NavigationPage is allowed and therefore even you call PushAsync() inside the TabbedPage, it will still push via your wrapping NavigationPage.
You can create a custom controller using the grid. it will remove the hassle of writing custom renderers.

Navigate back to MainPage Visual Studio 2013

I have a windows phone app that navigates between pages and I use
NavigationService.GoBack();
to go back to the Mainpage. All good and works great.
The app is a simple 2 page app and works great under IOS, Android and Windows Phone, but I need to find the correct way to go back to the MainPage in Windows Store Apps using VS2013EX.
I tried
Frame.GoBack();
but it does not work well due to the fact that my second page is a WebView and if I navigate to another page on the webview, the Frame.GoBack() does not remove the second page but just goes back to the other web page. Its almost like Frame.GoBack() is just the webView's go back method.
I tried this code:
this.Frame.Navigate(typeof(MainPage));
This does bring me back to the MainPage, but I don't think its correct as should I not be removing the current page from the Stack????
Try this: add an event handler for OnNavigatedFrom in which do the (WebviewName).NavigateToString("") and use this.Frame.GoBack().

Braintree payments using webforms

Is it possible to use Braintree payments with ASP.NET Web Forms? Braintree provides an MVC example.
I tried this solution but it doesn't work properly. Here is my server side code and my template; I changed the original version a little bit.
The main problem is that there is no action when the submit button is clicked -- the page just reloads. Why?
I work at Braintree.
I wrote a simple webforms example using Transparent Redirect that might help you with your issue.
Looking at your code and what you are describing as the issue, I would guess SessionUtils.Instance.TransparentRedirectURL is returning an empty string or null, so when you post the form it goes back to the current page.

Webbrowser and IE acts differently?

I'm in a trouble trying to fix some problem.. I have a program with Webbrowser control inside it.
It automates crawling process from some website. The problem is that I cannot fix webbrowser after recent website changes.
They have changed page navigation on website. And when I do actions MANUALLY in webbrowser (in my app) it doesn't go to the next/previous page on website. It does nothing... Whereas it works properly in IE 7/8/9 (only scripting errors thrown this time).
So does it mean that Webbrowser is not fully similar to IE??
I'm sorry for not showing source codes here, I think it wouldn't help here. Which way should I go to troubleshoot it? Why page navigation is not working in Webbrowser control?
I tried to simply put Webbrowser on a Window Form in new project and tried to navigate page 2/3/../10 in the website catalog, but it simply changes page number and doesn't navigate to it...
EDIT: Website doesn't work propely even if I do actions manually in webbrowser using mouse clicks.. but works in IE.
EDIT2: I might be not clear in my question. The problem is that I cannot use website even Manually with mouseclicks via my Webbrowser control in app. It changes page number after I click on it, but it doesn't navigate to that page. It stays silent. I'm sure that AllowNavigation property is true. It worked just yesterday and stopped after website changes today... Please tell me which way should I go to troubleshoot it.. I thought that Webbrowser control acts the same way as Internet Explorer.. Any help from you highly appreciated! Thanks
EDIT3: Strange thing... i just loaded Extended Webbrowser and navigated to that website. Page navigation panel doesn't work there also.. Is it a bug on their side or some type of guard from crawlers? What do you think?
(http://www.codeproject.com/KB/cpp/ExtendedWebBrowser.aspx)
I'm sure this isn't the answer your want but using the webbrowser control to scrape websites is very painful to maintain.
Instead use the HttpWebRequest and HttpWebRepsonse objects to recreate the calls to the webserver.
You can use Fiddler (http://www.fiddler2.com/fiddler2) and your browser to record your web sessions and recreate them in code.
You can setup your webbrowser control to disable a number of features including navigation.
I.e. to disable nav in the C# WebBrowser control:
webBrowser1.AllowNavigation = false;
I'd double check that you're not doing anything like this.
I had the same issue with a certain web site that recently changed its format. It has to do with the version of IE used by the control.
Simply force the IE version used to the latest (in my case 9). Setting the appropriate registry item to 9999 for my application worked; see: Webbrowser control behaving different than IE

How to display EULA in WP7 application?

As stated by Microsoft, it's not possible to programatically navigate from the main page. I have a EULA page that I need to show if the user is using the app for the first time. My plan was to determine on the main page if the app has been used before. If not, I had planned to navigate to the EULA page, but this is not possible. How can I get around this navigation limitation?
The issue with a dedicated EULA page that is automatically pushed on the back stack is that the application won't quit when the user presses the Back key when in the EULA page.
You should instead use a Popup control that you show and hide when appropriate.
See Peter Torr's post on how to exit an application for more details and background.
It should be possible to navigate from the main page easily using:
if (!eulaAgreed)
NavigationService.Navigate(new Uri("/EULAPage.xaml", UriKind.Relative));
Probably best to put this code in OnNavigatedTo of your main page or even later in the page cycle using Dispatcher.BeginInvoke(...). Putting it before that (i.e. in the constructor or Loaded) may not work.
What do you think happens to the Navigation stack?
Would the users be able to access the EULA page again? maybe by clicking back from the MainPage ?

Categories