I am using navigation page for login after success login it will be redirect to MasterDetail Page?

I am using navigation page for login after success login it will be redirect to MasterDetail Page it work fine for me but issues is that when i resume application my application will be crash. below is my code

public partial class App : Application
{
public static bool userIsLogin { get; set; }
public App()
{
InitializeComponent();
if (!userIsLogin)
MainPage = new NavigationPage(new App3.Views.LoginPage()) {BarBackgroundColor=Color.Black };
else
MainPage = new Dashboard();// dashboard page is my master Detail page
}
}
// login page
public partial class LoginPage : ContentPage
{
public LoginPage()
{
Title = "Wellcome to login page";

        var button = new Button() { Text = "Login" };

        var entry = new StackLayout { Padding = 20, Spacing = 20, Children = { button } };
        Content = entry;

        button.Clicked += (sender, arg) => {

            App.userIsLogin = true;
            App.Current.MainPage = new Dashboard();
        };
    }
}
Tagged:

Best Answer

Answers

Sign In or Register to comment.