Replies: 1 comment
-
Your event handler for MessageBox.Query("Logging In", "Login Successful", "Ok");
Application.RequestStop();
Application.Run<MainWindow>();
Do you mean that you still recieve the 'Successful' message? If so that is because you have are still invoking that method ( If you change your code to the following (remove the red bits from your code, add the green bits) it sounds like you will get what you want: // When login button is clicked display a message popup
btnLogin.Clicked += () => {
if (usernameText.Text == "admin" && passwordText.Text == "password") {
- MessageBox.Query ("Logging In", "Login Successful", "Ok");
Application.RequestStop ();
+ Application.Run<MainWindow> ();
} else {
MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
}
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I need to create app with login page and after logging in few features. I want to what is the best way to do this? I used sample code from Example.cs but modified
btnLogin.Clicked += () => { if (usernameText.Text == "admin" && passwordText.Text == "password") { MessageBox.Query ("Logging In", "Login Successful", "Ok"); Application.RequestStop (); } else { MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok"); } };
to
btnLogin.Clicked += () => { if (usernameText.Text == "admin" && passwordText.Text == "password") { MessageBox.Query("Logging In", "Login Successful", "Ok"); Application.RequestStop(); Application.Run<MainWindow>(); } else { MessageBox.ErrorQuery("Logging In", "Incorrect username or password", "Ok"); } };
but now when I successfully log in, I still recieve MessageBox when clicking
Is that correct way or I should know abaout something else?
Beta Was this translation helpful? Give feedback.
All reactions