mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-29 09:18:01 +01:00
Updated Run<T> Scenario
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user