public void Executar(object _form1) { Stopwatch sw = new Stopwatch(); sw.Start(); List <Link> lista = GerenciadorLinks.LerLinks(); double TotalLinks = lista.Count(); double LinkProcessAtual = 0; Painel.model.QuantidadeErros = 0; if (this.InvokeRequired) { Invoke(new Action(() => { progressBar1.Visible = true; })); } foreach (var link in lista) { GerenciadorAcesso.AcessarLink(link.Endereco); LinkProcessAtual++; double porcentagem = LinkProcessAtual / TotalLinks * 100; if (this.InvokeRequired) { //Thread.Sleep(5000); Invoke(new Action(() => { progressBar1.Value = Convert.ToInt32(porcentagem); })); } } sw.Stop(); Painel.model.TempoDecorrido = sw.Elapsed; Painel.model.UltimaExecucao = DateTime.Now; if (_painel.InvokeRequired) { Invoke(new Action(() => { _painel.AtualizarTextoTela(); })); } ((Form1)_form1).notifyIcon1.ShowBalloonTip(1000, "Certweb", "Tarefa executada com sucesso!", ToolTipIcon.Info); //MessageBox.Show("Sucesso!"); }
private void Executar(object _form) { Stopwatch sw = new Stopwatch(); sw.Start(); List <Link> lista = GerenciadorLinks.LerLinks(); double TotalLinks = lista.Count; double LinkProcessamentoAtual = 0; Painel.Modelo.QuantidadeErros = 0; foreach (var link in lista) { GerenciadorDeAcesso.AcessarLink(link.Endereco); LinkProcessamentoAtual++; double Porcentagem = LinkProcessamentoAtual / TotalLinks * 100; if (this.InvokeRequired) { Invoke(new Action(() => { pnProgressBar.Value = Convert.ToInt32(Porcentagem); })); } } sw.Stop(); //sw.Elapsed.ToString("mm"); Painel.Modelo.TempoDecorrido = sw.Elapsed; Painel.Modelo.UltimaExecucao = DateTime.Now; if (_painel.InvokeRequired) { Invoke(new Action(() => { _painel.AtualizarTextoTela(); })); } ((TelaInicial)_form).CertwebSystemTray.ShowBalloonTip(1000, "Certweb", "Tarefas realizadas com sucesso!", ToolTipIcon.Info); //MessageBox.Show("Sucesso!"); }