1
Fork 0

added runtime args decode, and custom show/hide commands so they are resource lighter. Also added code for exiting

This commit is contained in:
Jake Howard 2014-11-04 17:25:54 +00:00
parent 6f28bfb8f6
commit 8486aefdf8

View file

@ -16,23 +16,27 @@ namespace Saviour_Backup_System
public mainWindow() { public mainWindow() {
InitializeComponent(); InitializeComponent();
//populates the drive list if (setup.runtimeArguements[0] == "STARTUP") { this.removeDisplay(); }
refreshDriveList(); else { this.showDisplay(); }
//selects the first item in the list of drives
connectedDrivesList.Items[0].Selected = true;
//Displays the details for the selected drive
displayDriveDetails(connectedDrivesList.SelectedItems[0].Text.Substring(0, 3));
//Starts the thread for displaying the capacity of a drive
formatDriveCapacityTimer.Start();
//Starts the timer for refreshing drive list
driveRefreshTimer.Start();
if (setup.runtimeArguements[0] == "STARTUP") { this.Hide(); }
} }
internal void removeDisplay() {
formatDriveCapacityTimer.Stop();
driveRefreshTimer.Stop();
clearDriveDetails();
this.Hide();
setup.icon.notifyIcon.Visible = true;
}
internal void showDisplay() {
this.Show();
refreshDriveList();
connectedDrivesList.Items[0].Selected = true;
displayDriveDetails(connectedDrivesList.SelectedItems[0].Text.Substring(0, 3));
formatDriveCapacityTimer.Start();
driveRefreshTimer.Start();
setup.icon.notifyIcon.Visible = false;
}
internal void refreshDriveList() { internal void refreshDriveList() {
DriveInfo[] drives = USBTools.getConnectedDrives(); DriveInfo[] drives = USBTools.getConnectedDrives();
@ -143,6 +147,20 @@ namespace Saviour_Backup_System
deviceTab.Visible = true; deviceTab.Visible = true;
deviceTab.Select(); deviceTab.Select();
} }
private void mainWindow_FormClosing(object sender, FormClosingEventArgs e) { /*setup.closeProgram(sender, e);*/ } private void mainWindow_FormClosing(object sender, FormClosingEventArgs e) {
switch (e.CloseReason)
{
case(CloseReason.ApplicationExitCall):
this.Close();
break;
case(CloseReason.UserClosing):
this.removeDisplay();
setup.icon.displayStillRunning();
break;
default:
this.Close();
break;
}
}
} }
} }