1
Fork 0

added code to return copy status to other windows

This commit is contained in:
Jake Howard 2014-11-22 22:52:02 +00:00
parent 6c6149caed
commit b248dfe593

View file

@ -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;
}
}
}