private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                using (FrmUser usr = new FrmUser()){
                    if (usr.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        tBar.Enabled = false;
                        this.Cursor  = Cursors.WaitCursor;

                        this.wsClient = new WSClient(usr.url);

                        if (this.wsClient.doLogin(usr.user_name, usr.key))
                        {
                            lbStatusConnection.Text = "Conectado";
                            lbUserName.Text         = usr.user_name;
                            btnLogin.Enabled        = false;
                            btnDisconnect.Enabled   = true;
                            btnQuery.Enabled        = true;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(this, exc.Message, Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                tBar.Enabled = true;
                this.Cursor  = Cursors.Default;
            }
        }
Exemple #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                using (FrmUser usr = new FrmUser()){
                    if (usr.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        tBar.Enabled = false;
                        this.Cursor = Cursors.WaitCursor;

                        this.wsClient = new WSClient(usr.url);

                        if(this.wsClient.doLogin(usr.user_name, usr.key)){
                            lbStatusConnection.Text = "Conectado";
                            lbUserName.Text = usr.user_name;
                            btnLogin.Enabled = false;
                            btnDisconnect.Enabled = true;
                            btnQuery.Enabled = true;
                        }
                    }
                }
            }
            catch(Exception exc)
            {
                MessageBox.Show(this, exc.Message, Application.ProductName,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                tBar.Enabled = true;
                this.Cursor = Cursors.Default;
            }
        }