1
Fork 0

Added more validation on selecting drive from list, and displaying tab when selected

This commit is contained in:
Jake Howard 2014-07-27 21:03:06 +01:00
parent f7f0abd98d
commit f50f74e554

View file

@ -18,6 +18,7 @@ namespace Saviour_Backup_System
{ {
InitializeComponent(); InitializeComponent();
refreshDriveList(); refreshDriveList();
setup.initProgram();
} }
public void refreshDriveList() public void refreshDriveList()
{ {
@ -33,15 +34,18 @@ namespace Saviour_Backup_System
private void connectedDrivesListRefresh_Click(object sender, EventArgs e) private void connectedDrivesListRefresh_Click(object sender, EventArgs e)
{ {
foreach (ListViewItem i in connectedDrivesList.SelectedItems){ i.Selected = false; } //Deselected all elements in the list first
refreshDriveList(); refreshDriveList();
} }
private void connectedDrivesList_Select(object sender, EventArgs e) private void connectedDrivesList_Selection(object sender, ListViewItemSelectionChangedEventArgs e)
{ {
deviceTab.Visible = true; deviceTab.Visible = e.IsSelected;
ribbonControl1.RecalcLayout(); ribbonControl1.RecalcLayout();
if (!e.IsSelected) { backupRestoreTab.Select(); return; }
deviceTab.Select();
selectedDevice = connectedDrivesList.SelectedItems[0].Text; selectedDevice = connectedDrivesList.SelectedItems[0].Text;
MessageBox.Show(selectedDevice); USBTools.displayDriveDetails(selectedDevice.Substring(4));
} }
} }
} }