I am using the APP to connect to a device in Xamarin debug mode.
When the system is trying to connect to the device(like the screenshot shows "Connecting to device..."), if I press the back button to home(desktop) and back to APP, I find that the code will run App.xaml.cs
again, so I will see the screen will show Example_A_Page
again and then show Example_B_Page
afterward.
Then I tried again without the debug mode this time.
When I press the back button to home(desktop) and then back to APP, APP is still running Example_B_Page
.
Does anybody know why this situation happened?
Here is the pseudo code
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new NavigationPage(new Example_A_Page());
}
}
public partial class Example_A_Page : ContentPage
{
public Example_A_Page()
{
InitializeComponent();
}
protected async override void OnAppearing()
{
await Navigation.PushPopupAsync(new Example_B_Page());
}
}
public partial class Example_B_Page : ContentPage
{
public Example_B_Page()
{
InitializeComponent();
}
private async void Button_Clicked(object sender, EventArgs e)
{
//Do the connection behavior...
//Connected to the device...
}
}