1
Fork 0

added toolstrip code, and edited backup information display to display properly

This commit is contained in:
Jake Howard 2014-12-30 17:33:14 +00:00
parent 1881ab35ff
commit 7c58fa2fdb

View file

@ -69,13 +69,16 @@ namespace Saviour_Backup_System
private void connectedDrivesListRefresh_Click(object sender, EventArgs e) private void connectedDrivesListRefresh_Click(object sender, EventArgs e)
{ {
toolStripProgress.Visible = true;
foreach (ListViewItem i in connectedDrivesList.SelectedItems){ i.Selected = false; } //Deselected all elements in the list first foreach (ListViewItem i in connectedDrivesList.SelectedItems){ i.Selected = false; } //Deselected all elements in the list first
clearDriveDetails(); clearDriveDetails();
refreshDriveList(); refreshDriveList();
toolStripProgress.Visible = false;
} }
private void connectedDrivesList_Selection(object sender, ListViewItemSelectionChangedEventArgs e) { private void connectedDrivesList_Selection(object sender, ListViewItemSelectionChangedEventArgs e) {
toolStripProgress.Visible = true;
if (!e.IsSelected) { if (!e.IsSelected) {
deviceTab.Visible = false; deviceTab.Visible = false;
backupRestoreTab.Select(); backupRestoreTab.Select();
@ -86,9 +89,11 @@ namespace Saviour_Backup_System
populateDeviceTab(); populateDeviceTab();
string selectedDevice = connectedDrivesList.SelectedItems[0].Text; string selectedDevice = connectedDrivesList.SelectedItems[0].Text;
displayDriveDetails(USBTools.getDriveObject(selectedDevice.Substring(0,1))); displayDriveDetails(USBTools.getDriveObject(selectedDevice.Substring(0,1)));
toolStripProgress.Visible = false;
} }
private void displayDriveDetails(DriveInfo drive) { private void displayDriveDetails(DriveInfo drive) {
toolStripProgress.Visible = true;
selectedDrive = drive; selectedDrive = drive;
driveNameDisplay.Text = tools.Trim(selectedDrive.VolumeLabel, 16); driveNameDisplay.Text = tools.Trim(selectedDrive.VolumeLabel, 16);
driveLetterDisplay.Text = selectedDrive.Name; driveLetterDisplay.Text = selectedDrive.Name;
@ -106,9 +111,11 @@ namespace Saviour_Backup_System
driveIconBox.Image = Properties.Resources.hddIcon; driveIconBox.Image = Properties.Resources.hddIcon;
break; break;
} }
long timeStamp = databaseTools.getBackupCreationDate(USBTools.calculateDriveID(selectedDrive));
backupDirectoryDisplay.Text = databaseTools.getBackupDirectory(USBTools.calculateDriveID(selectedDrive)); backupDirectoryDisplay.Text = databaseTools.getBackupDirectory(USBTools.calculateDriveID(selectedDrive));
creationDateDisplay.Text = databaseTools.getBackupCreationDate(USBTools.calculateDriveID(selectedDrive)).ToString(); if (timeStamp == 0L) { creationDateDisplay.Text = "NONE"; }
if (creationDateDisplay.Text == 0.ToString()) { creationDateDisplay.Text = "NONE"; } else { creationDateDisplay.Text = tools.unixDateTime(timeStamp).ToString(); }
toolStripProgress.Visible = false;
} }
private void formatDriveCapacity() private void formatDriveCapacity()
@ -182,7 +189,7 @@ namespace Saviour_Backup_System
private void currentTransfersButton_Click(object sender, EventArgs e) private void currentTransfersButton_Click(object sender, EventArgs e)
{ {
setup.CT.ShowDialog(); setup.CT.Show();
} }
private void viewAllRulesButton_Click(object sender, EventArgs e) private void viewAllRulesButton_Click(object sender, EventArgs e)
@ -193,8 +200,19 @@ namespace Saviour_Backup_System
private void backupDeviceButton_Click(object sender, EventArgs e) private void backupDeviceButton_Click(object sender, EventArgs e)
{ {
setup.CT.startCopy(selectedDrive, databaseTools.getBackupDirectory(USBTools.calculateDriveID(selectedDrive)), true); if (backupDirectoryDisplay.Text != "NONE") {
MessageBox.Show("Backup initiated for drive '" + selectedDrive.VolumeLabel + "'", "Backup started", MessageBoxButtons.OK, MessageBoxIcon.Information); toolStripProgress.Visible = true;
setup.CT.startCopy(selectedDrive, databaseTools.getBackupDirectory(USBTools.calculateDriveID(selectedDrive)), true);
MessageBox.Show("Backup initiated for drive '" + selectedDrive.VolumeLabel + "'", "Backup started", MessageBoxButtons.OK, MessageBoxIcon.Information);
toolStripProgress.Visible = false;
}
else { MessageBox.Show("You cannot backup a drive without a record. Please create one before continueing!", "No Backup Exists", MessageBoxButtons.OK, MessageBoxIcon.Stop); }
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(databaseTools.conn.State.ToString());
} }
} }
} }