From b248dfe593b390041db1c24597e24ccf0d3dd5a9 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 22 Nov 2014 22:52:02 +0000 Subject: [PATCH] added code to return copy status to other windows --- Saviour Backup System/transferWindow.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Saviour Backup System/transferWindow.cs b/Saviour Backup System/transferWindow.cs index 9fe1e37..425f5d2 100644 --- a/Saviour Backup System/transferWindow.cs +++ b/Saviour Backup System/transferWindow.cs @@ -15,21 +15,32 @@ namespace Saviour_Backup_System public partial class transferWindow : Form, CopyFiles.ICopyFilesDiag { public System.ComponentModel.ISynchronizeInvoke SynchronizationObject { get; set; } - public transferWindow() + int arrayIndex; + public transferWindow(int backups) { InitializeComponent(); + arrayIndex = backups; + currentFileProgress.Maximum = 1000; } public void update(Int32 totalFiles, Int32 copiedFiles, Int64 totalBytes, Int64 copiedBytes, string currentFilename) { totalFilesProgress.Maximum = totalFiles; totalFilesProgress.Value = copiedFiles; - currentFileProgress.Maximum = 100; //so its a percentage, might make it more accurate. if (totalBytes != 0) { - currentFileProgress.Value = Convert.ToInt32((100f / (totalBytes / 1024f)) * (copiedBytes / 1024f)); + currentFileProgress.Value = Convert.ToInt32((1000f / (totalBytes / 1024f)) * (copiedBytes / 1024f)); } totalFilesProgress.Text = "Copying File " + copiedFiles + " of " + totalFiles + "."; currentFile.Text = currentFilename; + setup.CT.progressBars[arrayIndex].Value = totalFilesProgress.Value; + setup.CT.progressBars[arrayIndex].Maximum = totalFiles; + setup.CT.progressBars[arrayIndex].Text = "Copying " + (copiedBytes / 1024f).ToString() + " of " + (totalBytes / 1024f).ToString(); + + if (setup.MW.selectedDrive.Name.Substring(0, 1) == currentFilename.Substring(0, 1)) { + setup.MW.backupProgress.Value = totalFilesProgress.Value; + setup.MW.backupProgress.Maximum = totalFiles; + } + } public void cancelCopy() { @@ -42,5 +53,10 @@ namespace Saviour_Backup_System { cancelCopy(); } + + private void minimizeButton_Click(object sender, EventArgs e) + { + this.WindowState = FormWindowState.Minimized; + } } }