Esempio n. 1
0
        private async void btnConectar_Click(object sender, EventArgs e)
        {
            if (btnConectar.Text == "DESCONECTAR")
            {
                richTextBox1.Visible    = false;
                btnConectar.Text        = "CONECTAR";
                MetodosEstaticos.status = false;
            }
            else
            {
                try
                {
                    btnConectar.Text = "CONECTANDO";
                    await MetodosEstaticos.ConectarWebService(txtUrl.Text, "bearer", txtToken.Text);

                    if (!MetodosEstaticos.status)
                    {
                        MessageBox.Show("Por favor verifique a URL e o Token de acesso!");
                        btnConectar.Text = "CONECTAR";
                    }
                    else
                    {
                        richTextBox1.Visible = true;
                        btnConectar.Text     = "DESCONECTAR";
                    }
                }
                catch (Exception erro)
                {
                    MessageBox.Show(erro.Message);
                    btnConectar.Text = "CONECTAR";
                }
            }
        }
Esempio n. 2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                await MetodosEstaticos.ConectarWebService();

                dataGridView1.DataSource = MetodosEstaticos.listaDados;
                AtualizarGraficoGeral();
                AtualizarBotoes();
                btnEst1_Click(sender, e);
            }
            catch
            {
                MessageBox.Show("Não foi possível atualizar");
            }
        }