コード例 #1
0
        private async void loginButton_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            this.Cursor  = Cursors.WaitCursor;
            try
            {
                if (await RepositoryController.TestServer(serverTextBox.Text, userTextBox.Text, passwordTextBox.Text))
                {
                    this.Cursor = Cursors.Default;
                    this.passwordTextBox.Text = "";
                    var mainScreen = new MainScreen(serverTextBox.Text, userTextBox.Text, passwordTextBox.Text);
                    this.Visible = false;
                    mainScreen.ShowDialog();
                    this.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"No se pudo conectar {ex.Message}");
            }

            this.Enabled = true;
            this.Cursor  = Cursors.Default;
        }