Updated Run<T> Scenario

This commit is contained in:
Tig
2024-06-17 07:55:26 -07:00
parent f1d69fd4bb
commit 515bc3cce7

View File

@@ -25,7 +25,7 @@ public class RunTExample : Scenario
// Create input components and labels
var usernameLabel = new Label { Text = "Username:" };
_usernameText = new TextField
_usernameText = new()
{
// Position text field adjacent to the label
X = Pos.Right (usernameLabel) + 1,
@@ -62,21 +62,21 @@ public class RunTExample : Scenario
// When login button is clicked display a message popup
btnLogin.Accept += (s, e) =>
{
if (_usernameText.Text == "admin" && passwordText.Text == "password")
{
MessageBox.Query ("Login Successful", $"Username: {_usernameText.Text}", "Ok");
Application.RequestStop ();
}
else
{
MessageBox.ErrorQuery (
"Error Logging In",
"Incorrect username or password (hint: admin/password)",
"Ok"
);
}
};
{
if (_usernameText.Text == "admin" && passwordText.Text == "password")
{
MessageBox.Query ("Login Successful", $"Username: {_usernameText.Text}", "Ok");
Application.RequestStop ();
}
else
{
MessageBox.ErrorQuery (
"Error Logging In",
"Incorrect username or password (hint: admin/password)",
"Ok"
);
}
};
// Add the views to the Window
Add (usernameLabel, _usernameText, passwordLabel, passwordText, btnLogin);