private void WebClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { Dispatcher.Invoke(new Action(() => PrograssL1.Content = "Installing...")); var bytes = e.Result; WebClient.Dispose(); new Thread(() => { string tempFolder = Path.Combine(Program.StartDirectory, "downloads"); if (!Directory.Exists(tempFolder)) { Directory.CreateDirectory(tempFolder); } string filePath = Path.Combine(tempFolder, "download.bin"); File.WriteAllBytes(filePath, bytes); if (bytes[0] == 'P') { AddModForm.InstallFromZip(filePath); // Install from a zip } else { AddModForm.InstallFrom7zArchive(filePath); // Use 7-Zip or WinRAR if its not a Zip } Dispatcher.Invoke(new Action(() => Close())); }).Start(); }
private void DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { var bytes = e.Result; string tempFolder = Path.Combine(Program.StartDirectory, "downloads"); if (!Directory.Exists(tempFolder)) { Directory.CreateDirectory(tempFolder); } string filePath = Path.Combine(tempFolder, "download.bin"); File.WriteAllBytes(filePath, bytes); if (bytes[0] == 'P') { AddModForm.InstallFromZip(filePath); // Install from a zip } else { AddModForm.InstallFrom7zArchive(filePath); // Use 7-Zip or WinRAR if its not a Zip } Invoke(new Action(() => Close())); return; }