I am creating a xamarin forms app.My app flow is LOGIN-->MAINPAGE. The Mainpage is a Bottombarpage contains three options. 1.DashBoard, 2.Settings, 3.User . I added a logout icon on Dashboard class toolbar. My problem is whenever user click on logout, screen will navigate to login page. But if user press backbutton it will go to previous mainpage. I want to disable that.
Iam navigating from loginpage to Main page is like this.
Navigation.InsertPageBefore(new MainPage(), this);
await Navigation.PopAsync();
My App.xaml.cs - I using a validation for navigation to main page
if (Settings.Generalsettings != string.Empty)
{
MainPage = new NavigationPage(new MainPage());
}
else {
MainPage = new NavigationPage(new Login());
}
My logout button click on Dashboard.cs
private void logout_Clicked(object sender,EventArgs e)
{
Settings.ClearAllData();
Navigation.PushAsync(new Login());
}