private void DoBackup(IUsbDriveInfo info) { _checkForUsbKeyTimer.Enabled = false; _noteLabel.Visible = false; _topLabel.Text = "~Backing Up..."; Refresh(); try { string dest = Path.Combine(info.RootDirectory.FullName, _projectInfo.Name + "_wesay.zip"); BackupMaker.BackupToExternal(_projectInfo.PathToTopLevelDirectory, dest, _projectInfo.FilesBelongingToProject); _topLabel.Text = "~Backup Complete"; _noteLabel.Visible = true; _noteLabel.Text = String.Format("~Files backed up to {0}", dest); } catch (Exception e) { ErrorReport.NotifyUserOfProblem( "WeSay could to perform the backup. Reason: {0}", e.Message); _topLabel.Text = "~Files were not backed up."; _topLabel.ForeColor = Color.Red; } _cancelButton.Text = "&OK"; }
private static bool IsAKnownBackupDrive(IUsbDriveInfo drive) { //though I could not reproduce it D Rowe had found that removing the drive before the popup closed gave and exception here try { return(Directory.Exists(BackupControl.GetDestinationFolderPath(drive.RootDirectory.ToString()))); } catch { return(false); } }
private static void LaunchBackup(IProgress progress, IProgress fileLogProgress, IUsbDriveInfo drive) { long totalSpaceInKilobytes = (long)(drive.TotalSize / 1024); long freeSpaceInKilobytes = (long)(drive.AvailableFreeSpace / 1024); string destinationDeviceRoot = drive.RootDirectory.ToString(); var backupControl = new BackupControl(destinationDeviceRoot, freeSpaceInKilobytes, totalSpaceInKilobytes, progress); UsageReporter.SendNavigationNotice("StartBackup"); Settings.Default.Save(); using (var form = new MainWindow(backupControl, progress)) { form.ShowDialog(); if (fileLogProgress != null) { fileLogProgress.WriteMessage("Finished showing Dialog"); } } }