Advertisement
Advertisement
| 05.12.2008 at 03:55PM PDT, ID: 23396226 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: |
string[] copyFile = { DirectoryTB1 };
backgroundWorker1.DoWork += backgroundWorker1_DoWork;
backgroundWorker1.RunWorkerAsync(copyFile);
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
string DirectoryTextBox = copyFile[0].ToString();
try
{
using (ZipFile zip = new ZipFile(DirectoryTextBox + @"\Backup.zip"))
{
System.IO.Directory.SetCurrentDirectory(Environment.CurrentDirectory);
ProgressBar1.Visible = true;
Label2.Visible = true;
ProgressBar1.Value = ProgressBar1.Minimum;
//Add the Database File to the zip
zip.AddFile("DB.accdb");
Label2.Text = "Backing up Database...";
ProgressBar1.Increment(20);
//Add the Resources Folders and subdirectories to the zip
zip.AddItem("Files");
Label2.Text = "Backing up Files...";
ProgressBar1.Increment(70);
//Save the zip
zip.Save();
Label2.Text = "Database and Files Backed Up Successfully!";
ProgressBar1.Increment(10);
}
|