2014-11-20 14:27:37 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2014-11-21 22:34:43 +00:00
|
|
|
|
using CopyFiles;
|
|
|
|
|
|
2014-11-20 14:27:37 +00:00
|
|
|
|
|
|
|
|
|
namespace Saviour_Backup_System
|
|
|
|
|
{
|
2014-11-20 15:57:31 +00:00
|
|
|
|
public partial class transferWindow : Form, CopyFiles.ICopyFilesDiag
|
2014-11-20 14:27:37 +00:00
|
|
|
|
{
|
2014-11-21 22:34:43 +00:00
|
|
|
|
public System.ComponentModel.ISynchronizeInvoke SynchronizationObject { get; set; }
|
2014-11-22 22:52:02 +00:00
|
|
|
|
int arrayIndex;
|
|
|
|
|
public transferWindow(int backups)
|
2014-11-20 14:27:37 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-11-22 22:52:02 +00:00
|
|
|
|
arrayIndex = backups;
|
|
|
|
|
currentFileProgress.Maximum = 1000;
|
2014-11-20 14:27:37 +00:00
|
|
|
|
}
|
2014-11-20 15:57:31 +00:00
|
|
|
|
public void update(Int32 totalFiles, Int32 copiedFiles, Int64 totalBytes, Int64 copiedBytes, string currentFilename)
|
|
|
|
|
{
|
|
|
|
|
totalFilesProgress.Maximum = totalFiles;
|
|
|
|
|
totalFilesProgress.Value = copiedFiles;
|
|
|
|
|
|
|
|
|
|
if (totalBytes != 0) {
|
2014-11-22 22:52:02 +00:00
|
|
|
|
currentFileProgress.Value = Convert.ToInt32((1000f / (totalBytes / 1024f)) * (copiedBytes / 1024f));
|
2014-11-20 15:57:31 +00:00
|
|
|
|
}
|
|
|
|
|
totalFilesProgress.Text = "Copying File " + copiedFiles + " of " + totalFiles + ".";
|
|
|
|
|
currentFile.Text = currentFilename;
|
2014-11-22 22:52:02 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-20 15:57:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-21 22:34:43 +00:00
|
|
|
|
public void cancelCopy() {
|
|
|
|
|
if (EN_cancelCopy != null) { EN_cancelCopy(); }
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-20 15:57:31 +00:00
|
|
|
|
public event CopyFiles.CopyFiles.DEL_cancelCopy EN_cancelCopy;
|
2014-11-21 22:34:43 +00:00
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cancelCopy();
|
|
|
|
|
}
|
2014-11-22 22:52:02 +00:00
|
|
|
|
|
|
|
|
|
private void minimizeButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.WindowState = FormWindowState.Minimized;
|
|
|
|
|
}
|
2014-11-20 14:27:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|