So many god damn comments!! Summaries for all functions in files done!
This commit is contained in:
parent
af2f75e1cd
commit
fd5af99db6
5 changed files with 195 additions and 12 deletions
|
@ -22,6 +22,9 @@ namespace Saviour_Backup_System
|
||||||
this.Size = new Size(583, 269);
|
this.Size = new Size(583, 269);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the tooltips to controls
|
||||||
|
/// </summary>
|
||||||
private void assignToolTips() {
|
private void assignToolTips() {
|
||||||
ToolTip tempTip = new ToolTip();
|
ToolTip tempTip = new ToolTip();
|
||||||
tempTip.AutoPopDelay = 5000;
|
tempTip.AutoPopDelay = 5000;
|
||||||
|
@ -40,6 +43,11 @@ namespace Saviour_Backup_System
|
||||||
tempTip.SetToolTip(this.directoryBrowseButton, "Where?\nClick here to browse your computer to find where to store the backup.");
|
tempTip.SetToolTip(this.directoryBrowseButton, "Where?\nClick here to browse your computer to find where to store the backup.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Browse through window directory to select backup directory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void directoryBrowseButton_Click(object sender, EventArgs e)
|
private void directoryBrowseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
|
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
|
||||||
|
@ -50,6 +58,9 @@ namespace Saviour_Backup_System
|
||||||
folderBrowserDialog.Dispose(); //memory management
|
folderBrowserDialog.Dispose(); //memory management
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fill dropdown with available drives
|
||||||
|
/// </summary>
|
||||||
private void populateDropdown()
|
private void populateDropdown()
|
||||||
{
|
{
|
||||||
DriveInfo[] drives = USBTools.getConnectedDrives();
|
DriveInfo[] drives = USBTools.getConnectedDrives();
|
||||||
|
@ -58,6 +69,10 @@ namespace Saviour_Backup_System
|
||||||
drivesDropdown.Items.Add(drive.Name + " " + drive.VolumeLabel);
|
drivesDropdown.Items.Add(drive.Name + " " + drive.VolumeLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all content from inputs
|
||||||
|
/// </summary>
|
||||||
private void clearControls()
|
private void clearControls()
|
||||||
{
|
{
|
||||||
backupNameInput.Text = "";
|
backupNameInput.Text = "";
|
||||||
|
@ -67,6 +82,11 @@ namespace Saviour_Backup_System
|
||||||
previousBackupInput.Value = 0;
|
previousBackupInput.Value = 0;
|
||||||
folderPath.Text = "";
|
folderPath.Text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mark all controls as read only, or unmark
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
private void lockControls(bool state)
|
private void lockControls(bool state)
|
||||||
{
|
{
|
||||||
backupNameInput.ReadOnly = state;
|
backupNameInput.ReadOnly = state;
|
||||||
|
@ -76,6 +96,12 @@ namespace Saviour_Backup_System
|
||||||
previousBackupInput.Enabled = !state;
|
previousBackupInput.Enabled = !state;
|
||||||
folderPath.ReadOnly = state;
|
folderPath.ReadOnly = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the backup record from given information
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void createButton_Click(object sender, EventArgs e) {
|
private void createButton_Click(object sender, EventArgs e) {
|
||||||
DriveInfo drive = USBTools.getDriveObject(drivesDropdown.Text.Substring(0, 1));
|
DriveInfo drive = USBTools.getDriveObject(drivesDropdown.Text.Substring(0, 1));
|
||||||
lockControls(true);
|
lockControls(true);
|
||||||
|
@ -122,6 +148,10 @@ namespace Saviour_Backup_System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create record for drive
|
||||||
|
/// </summary>
|
||||||
private void createRecord() {
|
private void createRecord() {
|
||||||
SqlCeConnection conn = databaseTools.conn;
|
SqlCeConnection conn = databaseTools.conn;
|
||||||
SqlCeCommand cmd = conn.CreateCommand();
|
SqlCeCommand cmd = conn.CreateCommand();
|
||||||
|
@ -170,6 +200,11 @@ namespace Saviour_Backup_System
|
||||||
|
|
||||||
private void insertionSwitch_Click(object sender, EventArgs e) { insertionSwitch.Value = !insertionSwitch.Value; }
|
private void insertionSwitch_Click(object sender, EventArgs e) { insertionSwitch.Value = !insertionSwitch.Value; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display warning for compression time
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void unifiedFileSwitch_Click(object sender, EventArgs e) {
|
private void unifiedFileSwitch_Click(object sender, EventArgs e) {
|
||||||
compressionSwitch.Value = !compressionSwitch.Value;
|
compressionSwitch.Value = !compressionSwitch.Value;
|
||||||
if(compressionSwitch.Value) {
|
if(compressionSwitch.Value) {
|
||||||
|
|
|
@ -21,7 +21,12 @@ namespace Saviour_Backup_System
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts a backup for a drive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drive">Drive object of backup drive</param>
|
||||||
|
/// <param name="endDirectory">Directory to store files</param>
|
||||||
|
/// <param name="visible">Will the progress window be displayed?</param>
|
||||||
public void startCopy(DriveInfo drive, string endDirectory, bool visible) { //used for validation to make sure the copy wont fail.
|
public void startCopy(DriveInfo drive, string endDirectory, bool visible) { //used for validation to make sure the copy wont fail.
|
||||||
if (!Directory.Exists(drive.Name)) { MessageBox.Show("The drive directory does not exist."); }
|
if (!Directory.Exists(drive.Name)) { MessageBox.Show("The drive directory does not exist."); }
|
||||||
|
|
||||||
|
@ -51,7 +56,15 @@ namespace Saviour_Backup_System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyFiles(string driveLetter, string endDirectory, bool display, DriveInfo drive, string hash) //actually starts the backups (and loads the dialogs)
|
/// <summary>
|
||||||
|
/// Run a backup of a drive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="driveLetter">Windows drive letter for drive</param>
|
||||||
|
/// <param name="endDirectory">Directory to store backed up files</param>
|
||||||
|
/// <param name="display">Will the progress window be displayed</param>
|
||||||
|
/// <param name="drive">Drive object for backup drive</param>
|
||||||
|
/// <param name="hash">Current hash of drive</param>
|
||||||
|
private void copyFiles(string driveLetter, string endDirectory, bool display, DriveInfo drive, string hash)
|
||||||
{
|
{
|
||||||
backups++; //appends to the number of backups running
|
backups++; //appends to the number of backups running
|
||||||
progressBars.Add(new copyProgressBar());
|
progressBars.Add(new copyProgressBar());
|
||||||
|
@ -68,6 +81,9 @@ namespace Saviour_Backup_System
|
||||||
if (!display) { transfersList[backups].Hide(); } //if it is a startup backup process, quickly hide the dialog.
|
if (!display) { transfersList[backups].Hide(); } //if it is a startup backup process, quickly hide the dialog.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Label for displaying backup information
|
||||||
|
/// </summary>
|
||||||
private class copyProgressLabel : Label {
|
private class copyProgressLabel : Label {
|
||||||
public copyProgressLabel()
|
public copyProgressLabel()
|
||||||
{
|
{
|
||||||
|
@ -78,6 +94,9 @@ namespace Saviour_Backup_System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Progressbar for displaying backup progress
|
||||||
|
/// </summary>
|
||||||
private class copyProgressBar : DevComponents.DotNetBar.Controls.ProgressBarX
|
private class copyProgressBar : DevComponents.DotNetBar.Controls.ProgressBarX
|
||||||
{
|
{
|
||||||
public copyProgressBar()
|
public copyProgressBar()
|
||||||
|
@ -101,6 +120,11 @@ namespace Saviour_Backup_System
|
||||||
this.Hide();
|
this.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the window of all controls
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void ClearButton_Click(object sender, EventArgs e)
|
private void ClearButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DialogResult result = MessageBox.Show("Are you sure you want to clear?\nThis will cancel all active transfers!", "Clear Window", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
|
DialogResult result = MessageBox.Show("Are you sure you want to clear?\nThis will cancel all active transfers!", "Clear Window", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
|
||||||
|
|
|
@ -18,7 +18,9 @@ namespace Saviour_Backup_System
|
||||||
|
|
||||||
private static void copyDatabase() { File.WriteAllBytes(@"" + databaseName, Resources.saviour); } //copy the file from resources
|
private static void copyDatabase() { File.WriteAllBytes(@"" + databaseName, Resources.saviour); } //copy the file from resources
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the database exists, and then pings the connection
|
||||||
|
/// </summary>
|
||||||
public static void init() {
|
public static void init() {
|
||||||
if (!File.Exists(databaseName)) { //if the database doesnt exists (program hasnt been run before)
|
if (!File.Exists(databaseName)) { //if the database doesnt exists (program hasnt been run before)
|
||||||
copyDatabase();
|
copyDatabase();
|
||||||
|
@ -27,6 +29,11 @@ namespace Saviour_Backup_System
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the drive name from an ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of the drive to search for</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static string getDriveName(string id) {
|
public static string getDriveName(string id) {
|
||||||
string name = "NONE";
|
string name = "NONE";
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
@ -41,6 +48,11 @@ namespace Saviour_Backup_System
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the backup directory for a drive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of the drive to search for</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static string getBackupDirectory(string id) {
|
public static string getBackupDirectory(string id) {
|
||||||
string directory = "NONE";
|
string directory = "NONE";
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
@ -57,6 +69,11 @@ namespace Saviour_Backup_System
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the creation date for a backup directory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of the drive to search for</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Int64 getBackupCreationDate(string id)
|
public static Int64 getBackupCreationDate(string id)
|
||||||
{
|
{
|
||||||
Int64 date = 0;
|
Int64 date = 0;
|
||||||
|
@ -76,7 +93,10 @@ namespace Saviour_Backup_System
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns what drives are set to back up automatically
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static string[] getAutomaticBackups()
|
public static string[] getAutomaticBackups()
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
@ -93,6 +113,11 @@ namespace Saviour_Backup_System
|
||||||
return IDs.ToArray();
|
return IDs.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the name of the backup
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drive">Drive object to search for</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static string getBackupName(DriveInfo drive)
|
public static string getBackupName(DriveInfo drive)
|
||||||
{
|
{
|
||||||
string name = "";
|
string name = "";
|
||||||
|
@ -111,6 +136,13 @@ namespace Saviour_Backup_System
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a backup record in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drive">Drive info object for backup drive</param>
|
||||||
|
/// <param name="startDate">Date the backup started (as UNIX timestamp)</param>
|
||||||
|
/// <param name="duration">How long the backup took to run (in seconds)</param>
|
||||||
|
/// <param name="hash">New hash of the drive</param>
|
||||||
public static void createBackupRecord(DriveInfo drive, Int64 startDate, Int64 duration, string hash)
|
public static void createBackupRecord(DriveInfo drive, Int64 startDate, Int64 duration, string hash)
|
||||||
{
|
{
|
||||||
string id = USBTools.calculateDriveID(drive);
|
string id = USBTools.calculateDriveID(drive);
|
||||||
|
@ -133,7 +165,11 @@ namespace Saviour_Backup_System
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the most recent hash of a drive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of drive to search for</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static string getHashofRecentBackup(string id)
|
public static string getHashofRecentBackup(string id)
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
@ -151,6 +187,12 @@ namespace Saviour_Backup_System
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if the drive is compressed
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of the drive to search for</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static bool isCompression(string id)
|
public static bool isCompression(string id)
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
@ -168,6 +210,10 @@ namespace Saviour_Backup_System
|
||||||
return compression;
|
return compression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all the drives that have backup records
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static DataTable getAllDriveBackups()
|
public static DataTable getAllDriveBackups()
|
||||||
{
|
{
|
||||||
DataTable table = new DataTable();
|
DataTable table = new DataTable();
|
||||||
|
@ -181,6 +227,10 @@ namespace Saviour_Backup_System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a drive record from the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="creationDate">Date of drive creation as UNIX timestamp</param>
|
||||||
public static void deleteDriveRecord(Int64 creationDate) {
|
public static void deleteDriveRecord(Int64 creationDate) {
|
||||||
conn.Open();
|
conn.Open();
|
||||||
cmd.CommandText = "DELETE FROM RecordSet, Drive WHERE Creation_Date=? AND Recordset.Drive_ID = Drive.ID;";
|
cmd.CommandText = "DELETE FROM RecordSet, Drive WHERE Creation_Date=? AND Recordset.Drive_ID = Drive.ID;";
|
||||||
|
@ -191,6 +241,15 @@ namespace Saviour_Backup_System
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update a drive record in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="backupName">Name of the backup record</param>
|
||||||
|
/// <param name="backupLocation">Location to store backup</param>
|
||||||
|
/// <param name="automatic">is the backup automatic on insert?</param>
|
||||||
|
/// <param name="compression">Will the backup be compressed</param>
|
||||||
|
/// <param name="previousBackups">How many previous backups will be stored</param>
|
||||||
|
/// <param name="creationDate">Creation date of record</param>
|
||||||
public static void updateDriveRecord(string backupName, string backupLocation, bool automatic, bool compression, int previousBackups, Int64 creationDate)
|
public static void updateDriveRecord(string backupName, string backupLocation, bool automatic, bool compression, int previousBackups, Int64 creationDate)
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
|
@ -24,6 +24,9 @@ namespace Saviour_Backup_System
|
||||||
catch { this.showDisplay(); }
|
catch { this.showDisplay(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop displaying the window
|
||||||
|
/// </summary>
|
||||||
public void removeDisplay() {
|
public void removeDisplay() {
|
||||||
formatDriveCapacityTimer.Stop();
|
formatDriveCapacityTimer.Stop();
|
||||||
driveRefreshTimer.Stop();
|
driveRefreshTimer.Stop();
|
||||||
|
@ -33,6 +36,9 @@ namespace Saviour_Backup_System
|
||||||
setup.icon.notifyIcon.Visible = true;
|
setup.icon.notifyIcon.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display the window
|
||||||
|
/// </summary>
|
||||||
public void showDisplay() {
|
public void showDisplay() {
|
||||||
refreshDriveList();
|
refreshDriveList();
|
||||||
connectedDrivesList.Update();
|
connectedDrivesList.Update();
|
||||||
|
@ -44,6 +50,9 @@ namespace Saviour_Backup_System
|
||||||
this.Show();
|
this.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh the list of drives in window
|
||||||
|
/// </summary>
|
||||||
public void refreshDriveList() {
|
public void refreshDriveList() {
|
||||||
DriveInfo[] drives = USBTools.getConnectedDrives();
|
DriveInfo[] drives = USBTools.getConnectedDrives();
|
||||||
if (connectedDrivesList.Items.Count == USBTools.countDrives()) { return; } //if there is no change in the numer
|
if (connectedDrivesList.Items.Count == USBTools.countDrives()) { return; } //if there is no change in the numer
|
||||||
|
@ -66,7 +75,11 @@ namespace Saviour_Backup_System
|
||||||
connectedDrivesList.Sort();
|
connectedDrivesList.Sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh drive button
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void connectedDrivesListRefresh_Click(object sender, EventArgs e)
|
private void connectedDrivesListRefresh_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
toolStripProgress.Visible = true;
|
toolStripProgress.Visible = true;
|
||||||
|
@ -76,7 +89,11 @@ namespace Saviour_Backup_System
|
||||||
toolStripProgress.Visible = false;
|
toolStripProgress.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When an item in the connected drives list is selected
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void connectedDrivesList_Selection(object sender, ListViewItemSelectionChangedEventArgs e) {
|
private void connectedDrivesList_Selection(object sender, ListViewItemSelectionChangedEventArgs e) {
|
||||||
toolStripProgress.Visible = true;
|
toolStripProgress.Visible = true;
|
||||||
if (!e.IsSelected) {
|
if (!e.IsSelected) {
|
||||||
|
@ -92,6 +109,10 @@ namespace Saviour_Backup_System
|
||||||
toolStripProgress.Visible = false;
|
toolStripProgress.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show the details of of the selected drive
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drive"></param>
|
||||||
private void displayDriveDetails(DriveInfo drive) {
|
private void displayDriveDetails(DriveInfo drive) {
|
||||||
toolStripProgress.Visible = true;
|
toolStripProgress.Visible = true;
|
||||||
selectedDrive = drive;
|
selectedDrive = drive;
|
||||||
|
@ -118,6 +139,9 @@ namespace Saviour_Backup_System
|
||||||
toolStripProgress.Visible = false;
|
toolStripProgress.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change value of drive capacity bar, and change format of value
|
||||||
|
/// </summary>
|
||||||
private void formatDriveCapacity()
|
private void formatDriveCapacity()
|
||||||
{
|
{
|
||||||
DriveInfo drive = selectedDrive;
|
DriveInfo drive = selectedDrive;
|
||||||
|
@ -137,7 +161,9 @@ namespace Saviour_Backup_System
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove the details of onscreen details panel
|
||||||
|
/// </summary>
|
||||||
private void clearDriveDetails() {
|
private void clearDriveDetails() {
|
||||||
string blankText = "";
|
string blankText = "";
|
||||||
selectedDrive = null;
|
selectedDrive = null;
|
||||||
|
@ -154,11 +180,19 @@ namespace Saviour_Backup_System
|
||||||
|
|
||||||
private void formatDriveCapacityTimer_Tick(object sender, EventArgs e) { try { formatDriveCapacity(); } catch { } } //Because background workers cant interact with the GUI (very quickly), so a timer has to
|
private void formatDriveCapacityTimer_Tick(object sender, EventArgs e) { try { formatDriveCapacity(); } catch { } } //Because background workers cant interact with the GUI (very quickly), so a timer has to
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display elements on device tab
|
||||||
|
/// </summary>
|
||||||
private void populateDeviceTab() {
|
private void populateDeviceTab() {
|
||||||
// put stuff in here for changing labels of buttons etc.
|
|
||||||
deviceTab.Visible = true;
|
deviceTab.Visible = true;
|
||||||
deviceTab.Select();
|
deviceTab.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Catch event for form closing
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void mainWindow_FormClosing(object sender, FormClosingEventArgs e) {
|
private void mainWindow_FormClosing(object sender, FormClosingEventArgs e) {
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
switch (e.CloseReason) {
|
switch (e.CloseReason) {
|
||||||
|
@ -179,6 +213,11 @@ namespace Saviour_Backup_System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display the add backup rules window
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void addBackupRuleButton_Click(object sender, EventArgs e)
|
private void addBackupRuleButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
setup.ABW = new addBackupWizard();
|
setup.ABW = new addBackupWizard();
|
||||||
|
@ -187,17 +226,32 @@ namespace Saviour_Backup_System
|
||||||
|
|
||||||
private void exitButton_Click(object sender, EventArgs e) { setup.closeProgram(); }
|
private void exitButton_Click(object sender, EventArgs e) { setup.closeProgram(); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display current transfer window
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void currentTransfersButton_Click(object sender, EventArgs e)
|
private void currentTransfersButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
setup.CT.Show();
|
setup.CT.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show all backup drives
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void viewAllRulesButton_Click(object sender, EventArgs e)
|
private void viewAllRulesButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
setup.BV = new backupViewer();
|
setup.BV = new backupViewer();
|
||||||
setup.BV.Show();
|
setup.BV.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run a backup of selected divce
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void backupDeviceButton_Click(object sender, EventArgs e)
|
private void backupDeviceButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (backupDirectoryDisplay.Text != "NONE") {
|
if (backupDirectoryDisplay.Text != "NONE") {
|
||||||
|
|
|
@ -11,7 +11,9 @@ namespace Saviour_Backup_System
|
||||||
{
|
{
|
||||||
public NotifyIcon notifyIcon = new NotifyIcon() ;
|
public NotifyIcon notifyIcon = new NotifyIcon() ;
|
||||||
public ContextMenu contextMenu = new ContextMenu();
|
public ContextMenu contextMenu = new ContextMenu();
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for notification icon
|
||||||
|
/// </summary>
|
||||||
public notificationIcon()
|
public notificationIcon()
|
||||||
{
|
{
|
||||||
notifyIcon.Text = "Saviour Backup System";
|
notifyIcon.Text = "Saviour Backup System";
|
||||||
|
@ -20,18 +22,27 @@ namespace Saviour_Backup_System
|
||||||
notifyIcon.ContextMenu = contextMenu;
|
notifyIcon.ContextMenu = contextMenu;
|
||||||
notifyIcon.Visible = true; //finally displays the tray icon
|
notifyIcon.Visible = true; //finally displays the tray icon
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the menu entries for notification icon
|
||||||
|
/// </summary>
|
||||||
private void populateList() {
|
private void populateList() {
|
||||||
contextMenu.MenuItems.Add("Show Interface", displayWindow);
|
contextMenu.MenuItems.Add("Show Interface", displayWindow);
|
||||||
contextMenu.MenuItems.Add("Copy Progress", showProgress);
|
contextMenu.MenuItems.Add("Copy Progress", showProgress);
|
||||||
contextMenu.MenuItems.Add("Exit", closeProgram);
|
contextMenu.MenuItems.Add("Exit", closeProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set right click menu events for notification icon
|
||||||
|
/// </summary>
|
||||||
private void displayWindow(object sender, EventArgs e) { setup.MW.showDisplay(); }
|
private void displayWindow(object sender, EventArgs e) { setup.MW.showDisplay(); }
|
||||||
private void showProgress(object sender, EventArgs e) { return; } //nothing yet!
|
private void showProgress(object sender, EventArgs e) { return; } //nothing yet!
|
||||||
private void closeProgram(object sender, EventArgs e) { setup.closeProgram(); }
|
private void closeProgram(object sender, EventArgs e) { setup.closeProgram(); }
|
||||||
|
|
||||||
public void displayStillRunning() {
|
/// <summary>
|
||||||
|
/// Set display message when program main window is closed.
|
||||||
|
/// </summary>
|
||||||
|
public void displayStillRunning() {
|
||||||
string title = "I'm Still Here!";
|
string title = "I'm Still Here!";
|
||||||
string message = "Saviour Backup System is still running in the background";
|
string message = "Saviour Backup System is still running in the background";
|
||||||
notifyIcon.ShowBalloonTip(2000, title, message, ToolTipIcon.Info);
|
notifyIcon.ShowBalloonTip(2000, title, message, ToolTipIcon.Info);
|
||||||
|
|
Reference in a new issue