I have and app with 3 pages P1, P2 and P3.
When the app is navigating from P2 to P1 it pass a parameter.
On P1 I am getting the parameter value and I am showing a messagebox.
This is working perfectly, the following scenario is the problem:
P2 -> P1, Apps shows the message, P1->P3, P3->P1 using the back button and the app shows the message again with the parameter value from the P2, but it should not show any message.
This is the code of P1:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
String payment = "";
if (NavigationContext.QueryString.TryGetValue("payment", out payment)) {
if (payment == "no")
{
MessageBox.Show("Your payment failed!.",
"Error", MessageBoxButton.OK);
}
}
}
This is the code for P2:
NavigationService.Navigate(new Uri("/MainPage.xaml?payment=no", UriKind.Relative));
P3 does not pass any parameters
What is wrong why the app shows the message when navigating from P3 to P1?
Any help will be greatly appreciated.