Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class frm_Painel_de_Producao : Form
- {
- frm_Progress_Bar pb = frm_Progress_Bar();
- private async void btnAtualizaGrid_Click(object sender, EventArgs e)
- {
- pb.Show();
- //desabilita os botões enquanto a tarefa é executada.
- btnCancelar.Enabled = false;
- btnIncluir.Enabled = false;
- btnAtualizaGrid.Enabled = false;
- // simply start and await the loading task
- await Task.Run(() => carregarGrid());
- pb.Close();
- // habilita os botões após tarefa evento de loading.
- btnAtualizaGrid.Enabled = true;
- btnCancelar.Enabled = true;
- btnIncluir.Enabled = true;
- }
- }
- public partial class frm_Progress_Bar : Form
- {
- public frm_Progress_Bar()
- {
- InitializeComponent();
- }
- }
- public void carregarGrid()
- {
- timer.Interval = 1000;
- timer.Tick += meuRelogio;
- timer.Start();
- dgvProducao.AutoGenerateColumns = false;
- dgvProducao.DataSource = clsPPCP.painelProducao();
- MeuBD.AbreXML();
- if (MeuBD.RequerUsuario == "1")
- {
- txtOperador.Focus();
- }
- else
- {
- txtOperador.Hide();
- txtNomeOperador.Hide();
- label8.Hide();
- txtCartao.Focus();
- }
- colorirGrid();
- //MeuBDex.AbreXML();
- relogio();
- }
Add Comment
Please, Sign In to add comment