public static void updateApp(String versaoABaixar, ApplicationUpdateForm form) { var tempDir = Path.GetTempPath(); Form = form; localFileName = Path.Combine(tempDir, versaoABaixar); try { using (WebClient webClient = new WebClient()) { telaProgresso = new TelaProgressoUpdate("Baixando Atualização. Aguarde.", ProgressBarStyle.Blocks, webClient); webClient.Credentials = new NetworkCredential(usuario, senha); webClient.DownloadProgressChanged += WebClient_DownloadProgressChanged; webClient.DownloadFileCompleted += WebClient_DownloadFileCompleted; telaProgresso.Show(); fileSize = getFileSize(Path.Combine(dominioFTP, versaoABaixar)); webClient.DownloadFileAsync(new Uri(Path.Combine(dominioFTP, versaoABaixar)), localFileName); } } catch (WebException we) { MessageBox.Show(we.Message); } catch(COMException ce) { MessageBox.Show(ce.Message); } }
private void procurarAtualizaçõesToolStripMenuItem_Click(object sender, EventArgs e) { var appUpdate = new ApplicationUpdateForm(); var dialog = appUpdate.ShowDialog(); }