1
Fork 0

added layout controls for transfers.

This commit is contained in:
Jake Howard 2014-11-22 22:46:09 +00:00
parent 14ee8107e0
commit fc531eeb2c
2 changed files with 68 additions and 31 deletions

View file

@ -31,8 +31,9 @@
this.components = new System.ComponentModel.Container();
this.ribbonControl1 = new DevComponents.DotNetBar.RibbonControl();
this.styleManager1 = new DevComponents.DotNetBar.StyleManager(this.components);
this.progressTemplate = new DevComponents.DotNetBar.Controls.ProgressBarX();
this.label1 = new System.Windows.Forms.Label();
this.layoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// ribbonControl1
@ -76,44 +77,47 @@
this.styleManager1.ManagerStyle = DevComponents.DotNetBar.eStyle.Office2010Black;
this.styleManager1.MetroColorParameters = new DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(System.Drawing.Color.White, System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(163)))), ((int)(((byte)(26))))));
//
// progressTemplate
//
//
//
//
this.progressTemplate.BackgroundStyle.Class = "";
this.progressTemplate.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.progressTemplate.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.progressTemplate.Location = new System.Drawing.Point(12, 59);
this.progressTemplate.Name = "progressTemplate";
this.progressTemplate.Size = new System.Drawing.Size(568, 26);
this.progressTemplate.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.progressTemplate.TabIndex = 1;
this.progressTemplate.Text = "Backup in Progress";
this.progressTemplate.TextVisible = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Lucida Sans Unicode", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(13, 38);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(52, 18);
this.label1.Size = new System.Drawing.Size(137, 18);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
this.label1.Text = "Current Transfers";
//
// layoutPanel
//
this.layoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.layoutPanel.Location = new System.Drawing.Point(0, 59);
this.layoutPanel.Name = "layoutPanel";
this.layoutPanel.Size = new System.Drawing.Size(592, 391);
this.layoutPanel.TabIndex = 3;
//
// button1
//
this.button1.Location = new System.Drawing.Point(286, 30);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// currentTransfers
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(592, 261);
this.ClientSize = new System.Drawing.Size(592, 450);
this.Controls.Add(this.button1);
this.Controls.Add(this.layoutPanel);
this.Controls.Add(this.label1);
this.Controls.Add(this.progressTemplate);
this.Controls.Add(this.ribbonControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "currentTransfers";
this.Text = "Current Transfers";
this.Load += new System.EventHandler(this.currentTransfers_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.currentTransfers_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();
@ -123,8 +127,9 @@
private DevComponents.DotNetBar.RibbonControl ribbonControl1;
private DevComponents.DotNetBar.StyleManager styleManager1;
private DevComponents.DotNetBar.Controls.ProgressBarX progressTemplate;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.FlowLayoutPanel layoutPanel;
private System.Windows.Forms.Button button1;
}
}

View file

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Saviour_Backup_System
{
@ -25,24 +26,55 @@ namespace Saviour_Backup_System
private void copyFiles(string driveLetter, string endDirectory, bool display) //actually starts the backups (and loads the dialogs)
{
backups++; //appends to the number of backups running
progressBars.Add(new copyProgressBar());
layoutPanel.Controls.Add(new copyProgressLabel());
layoutPanel.Controls.Add(progressBars[backups]);
copyFilesList.Add(new CopyFiles.CopyFiles(driveLetter + ":\\", endDirectory));
transfersList.Add(new transferWindow());
transfersList.Add(new transferWindow(backups));
transfersList[backups].SynchronizationObject = this;
copyFilesList[backups].CopyAsync(transfersList[backups]);
if (!display) { transfersList[backups].Hide(); }
if (!display) { transfersList[backups].Hide(); } //if it is a startup backup process, dont display the dialog.
}
private void currentTransfers_Load(object sender, EventArgs e)
private class copyProgressLabel : Label
{
foreach (DevComponents.DotNetBar.Controls.ProgressBarX PB in progressBars) { PB.Dispose(); }
for (int i = 0; i < backups; i++)
public copyProgressLabel()
{
progressBars.Add(new DevComponents.DotNetBar.Controls.ProgressBarX());
progressBars[i] = progressTemplate;
progressBars[i].Location = new Point(12, (30 * i) + 59);
base.InitLayout();
this.Font = new Font("Lucida Sans Unicode", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Text = "Content";
this.Margin = new Padding(20, 3, 0, 0);
}
}
private class copyProgressBar : DevComponents.DotNetBar.Controls.ProgressBarX
{
public copyProgressBar()
{
base.InitLayout();
this.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.Text = "Backup in Progress";
this.TextVisible = true;
this.Size = new Size(567, 27);
this.Margin = new Padding(12, 0, 0, 17);
this.ColorTable = DevComponents.DotNetBar.eProgressBarItemColor.Paused;
}
}
private void button1_Click(object sender, EventArgs e)
{
copyFiles("F", "K:\\Temp\\CopyTemp", true);
}
private void currentTransfers_FormClosing(object sender, FormClosingEventArgs e)
{
MessageBox.Show("Closing");
e.Cancel = true;
this.Hide();
}
}
}