private void DownloadUpdateDialogLoad(object sender, EventArgs e) { var uri = new Uri(_args.DownloadURL); _webClient = AutoUpdater.GetWebClient(uri, AutoUpdater.BasicAuthDownload); if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
private void ButtonUpdateClick(object sender, EventArgs e) { webBrowser.Size = new Size(723, 323); labelInformation.Show(); pictureBox1.Show(); labelfilesize.Show(); labelspeed.Show(); labelPerc.Show(); progressBar.Show(); var uri = new Uri(_args.DownloadURL); _webClient = AutoUpdater.GetWebClient(uri, AutoUpdater.BasicAuthDownload); _tempFile = Path.Combine(exePath + AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(exePath + AutoUpdater.DownloadPath)) { Directory.CreateDirectory(exePath + AutoUpdater.DownloadPath); } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); sw.Start(); labelInformation.Text = "Downloading in... " + _tempFile; progressBar.Cursor = Cursors.WaitCursor; }
private void Init() { uri = new Uri(_args.DownloadURL); _webClient = AutoUpdater.GetWebClient(uri, AutoUpdater.BasicAuthDownload); if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; }