1
Fork 0

moved controls and added compression warning.

This commit is contained in:
Jake Howard 2015-01-09 14:59:46 +00:00
parent 61888bce5c
commit e79436e2cd
2 changed files with 54 additions and 88 deletions

View File

@ -39,11 +39,9 @@
this.directoryBrowseButton = new System.Windows.Forms.Button();
this.introTextBox = new System.Windows.Forms.RichTextBox();
this.insertionSwitch = new DevComponents.DotNetBar.Controls.SwitchButton();
this.unifiedFileSwitch = new DevComponents.DotNetBar.Controls.SwitchButton();
this.compressionSwitch = new DevComponents.DotNetBar.Controls.SwitchButton();
this.label6 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.compressionTypeDropdown = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.previousBackupInput = new DevComponents.Editors.IntegerInput();
this.createButton = new System.Windows.Forms.Button();
@ -58,17 +56,17 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.backupNameInput.Font = new System.Drawing.Font("Lucida Sans Unicode", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.backupNameInput.Location = new System.Drawing.Point(302, 9);
this.backupNameInput.Location = new System.Drawing.Point(320, 9);
this.backupNameInput.MaxLength = 30;
this.backupNameInput.Name = "backupNameInput";
this.backupNameInput.Size = new System.Drawing.Size(249, 28);
this.backupNameInput.Size = new System.Drawing.Size(231, 28);
this.backupNameInput.TabIndex = 1;
//
// 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(183, 10);
this.label1.Location = new System.Drawing.Point(201, 10);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 18);
this.label1.TabIndex = 2;
@ -78,7 +76,7 @@
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Lucida Sans Unicode", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(245, 44);
this.label2.Location = new System.Drawing.Point(263, 44);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 18);
this.label2.TabIndex = 4;
@ -92,10 +90,10 @@
this.drivesDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.drivesDropdown.Font = new System.Drawing.Font("Lucida Sans Unicode", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.drivesDropdown.FormattingEnabled = true;
this.drivesDropdown.Location = new System.Drawing.Point(302, 43);
this.drivesDropdown.Location = new System.Drawing.Point(320, 43);
this.drivesDropdown.MaxDropDownItems = 26;
this.drivesDropdown.Name = "drivesDropdown";
this.drivesDropdown.Size = new System.Drawing.Size(249, 24);
this.drivesDropdown.Size = new System.Drawing.Size(231, 24);
this.drivesDropdown.Sorted = true;
this.drivesDropdown.TabIndex = 5;
//
@ -103,7 +101,7 @@
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Lucida Sans Unicode", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(12, 195);
this.label5.Location = new System.Drawing.Point(12, 165);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(81, 18);
this.label5.TabIndex = 10;
@ -115,7 +113,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.folderPath.Font = new System.Drawing.Font("Lucida Sans Unicode", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.folderPath.Location = new System.Drawing.Point(99, 191);
this.folderPath.Location = new System.Drawing.Point(99, 161);
this.folderPath.MaxLength = 30;
this.folderPath.Name = "folderPath";
this.folderPath.Size = new System.Drawing.Size(376, 28);
@ -124,7 +122,7 @@
// directoryBrowseButton
//
this.directoryBrowseButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.directoryBrowseButton.Location = new System.Drawing.Point(476, 191);
this.directoryBrowseButton.Location = new System.Drawing.Point(476, 161);
this.directoryBrowseButton.Name = "directoryBrowseButton";
this.directoryBrowseButton.Size = new System.Drawing.Size(75, 28);
this.directoryBrowseButton.TabIndex = 11;
@ -139,7 +137,7 @@
this.introTextBox.Location = new System.Drawing.Point(2, 12);
this.introTextBox.Name = "introTextBox";
this.introTextBox.ReadOnly = true;
this.introTextBox.Size = new System.Drawing.Size(175, 176);
this.introTextBox.Size = new System.Drawing.Size(193, 144);
this.introTextBox.TabIndex = 12;
this.introTextBox.TabStop = false;
this.introTextBox.Text = resources.GetString("introTextBox.Text");
@ -153,7 +151,7 @@
this.insertionSwitch.BackgroundStyle.Class = "";
this.insertionSwitch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.insertionSwitch.Font = new System.Drawing.Font("Lucida Sans Typewriter", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.insertionSwitch.Location = new System.Drawing.Point(487, 133);
this.insertionSwitch.Location = new System.Drawing.Point(487, 103);
this.insertionSwitch.Name = "insertionSwitch";
this.insertionSwitch.OffBackColor = System.Drawing.Color.DarkRed;
this.insertionSwitch.OffTextColor = System.Drawing.Color.White;
@ -164,31 +162,31 @@
this.insertionSwitch.TabIndex = 13;
this.insertionSwitch.Click += new System.EventHandler(this.insertionSwitch_Click);
//
// unifiedFileSwitch
// compressionSwitch
//
this.unifiedFileSwitch.BackColor = System.Drawing.SystemColors.ControlDark;
this.compressionSwitch.BackColor = System.Drawing.SystemColors.ControlDark;
//
//
//
this.unifiedFileSwitch.BackgroundStyle.Class = "";
this.unifiedFileSwitch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.unifiedFileSwitch.Font = new System.Drawing.Font("Lucida Sans Typewriter", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.unifiedFileSwitch.Location = new System.Drawing.Point(487, 162);
this.unifiedFileSwitch.Name = "unifiedFileSwitch";
this.unifiedFileSwitch.OffBackColor = System.Drawing.Color.DarkRed;
this.unifiedFileSwitch.OffTextColor = System.Drawing.Color.White;
this.unifiedFileSwitch.OnBackColor = System.Drawing.Color.LimeGreen;
this.unifiedFileSwitch.OnTextColor = System.Drawing.Color.Black;
this.unifiedFileSwitch.Size = new System.Drawing.Size(64, 23);
this.unifiedFileSwitch.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.unifiedFileSwitch.TabIndex = 15;
this.unifiedFileSwitch.Click += new System.EventHandler(this.unifiedFileSwitch_Click);
this.compressionSwitch.BackgroundStyle.Class = "";
this.compressionSwitch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.compressionSwitch.Font = new System.Drawing.Font("Lucida Sans Typewriter", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.compressionSwitch.Location = new System.Drawing.Point(487, 132);
this.compressionSwitch.Name = "compressionSwitch";
this.compressionSwitch.OffBackColor = System.Drawing.Color.DarkRed;
this.compressionSwitch.OffTextColor = System.Drawing.Color.White;
this.compressionSwitch.OnBackColor = System.Drawing.Color.LimeGreen;
this.compressionSwitch.OnTextColor = System.Drawing.Color.Black;
this.compressionSwitch.Size = new System.Drawing.Size(64, 23);
this.compressionSwitch.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.compressionSwitch.TabIndex = 15;
this.compressionSwitch.Click += new System.EventHandler(this.unifiedFileSwitch_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(343, 136);
this.label6.Location = new System.Drawing.Point(343, 106);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(139, 18);
this.label6.TabIndex = 16;
@ -198,45 +196,17 @@
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label8.Location = new System.Drawing.Point(347, 164);
this.label8.Location = new System.Drawing.Point(347, 134);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(134, 18);
this.label8.Size = new System.Drawing.Size(129, 18);
this.label8.TabIndex = 18;
this.label8.Text = "Unified Backup File";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("Lucida Sans Unicode", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label9.Location = new System.Drawing.Point(186, 74);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(110, 18);
this.label9.TabIndex = 20;
this.label9.Text = "Compression:";
//
// compressionTypeDropdown
//
this.compressionTypeDropdown.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.compressionTypeDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.compressionTypeDropdown.Font = new System.Drawing.Font("Lucida Sans Unicode", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.compressionTypeDropdown.FormattingEnabled = true;
this.compressionTypeDropdown.Items.AddRange(new object[] {
"None",
"ZIP Archive (*.zip)"});
this.compressionTypeDropdown.Location = new System.Drawing.Point(302, 73);
this.compressionTypeDropdown.MaxDropDownItems = 26;
this.compressionTypeDropdown.Name = "compressionTypeDropdown";
this.compressionTypeDropdown.Size = new System.Drawing.Size(249, 24);
this.compressionTypeDropdown.Sorted = true;
this.compressionTypeDropdown.TabIndex = 21;
this.label8.Text = "Use Compression";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Lucida Sans Unicode", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(325, 106);
this.label3.Location = new System.Drawing.Point(325, 76);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(140, 18);
this.label3.TabIndex = 23;
@ -255,7 +225,7 @@
this.previousBackupInput.ButtonFreeText.Shortcut = DevComponents.DotNetBar.eShortcut.F2;
this.previousBackupInput.Cursor = System.Windows.Forms.Cursors.Arrow;
this.previousBackupInput.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.previousBackupInput.Location = new System.Drawing.Point(471, 103);
this.previousBackupInput.Location = new System.Drawing.Point(471, 73);
this.previousBackupInput.MaxValue = 999;
this.previousBackupInput.MinValue = -1;
this.previousBackupInput.Name = "previousBackupInput";
@ -266,7 +236,7 @@
// createButton
//
this.createButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.createButton.Location = new System.Drawing.Point(395, 225);
this.createButton.Location = new System.Drawing.Point(395, 195);
this.createButton.Name = "createButton";
this.createButton.Size = new System.Drawing.Size(156, 27);
this.createButton.TabIndex = 27;
@ -282,7 +252,7 @@
this.statusProgress.BackgroundStyle.Class = "";
this.statusProgress.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.statusProgress.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.statusProgress.Location = new System.Drawing.Point(12, 258);
this.statusProgress.Location = new System.Drawing.Point(12, 228);
this.statusProgress.Name = "statusProgress";
this.statusProgress.ProgressType = DevComponents.DotNetBar.eProgressItemType.Marquee;
this.statusProgress.Size = new System.Drawing.Size(539, 26);
@ -301,16 +271,14 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(563, 294);
this.ClientSize = new System.Drawing.Size(563, 259);
this.Controls.Add(this.statusProgress);
this.Controls.Add(this.createButton);
this.Controls.Add(this.previousBackupInput);
this.Controls.Add(this.label3);
this.Controls.Add(this.compressionTypeDropdown);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label6);
this.Controls.Add(this.unifiedFileSwitch);
this.Controls.Add(this.compressionSwitch);
this.Controls.Add(this.insertionSwitch);
this.Controls.Add(this.introTextBox);
this.Controls.Add(this.directoryBrowseButton);
@ -345,11 +313,9 @@
private System.Windows.Forms.Button directoryBrowseButton;
private System.Windows.Forms.RichTextBox introTextBox;
private DevComponents.DotNetBar.Controls.SwitchButton insertionSwitch;
private DevComponents.DotNetBar.Controls.SwitchButton unifiedFileSwitch;
private DevComponents.DotNetBar.Controls.SwitchButton compressionSwitch;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox compressionTypeDropdown;
private System.Windows.Forms.Label label3;
private DevComponents.Editors.IntegerInput previousBackupInput;
private System.Windows.Forms.Button createButton;

View File

@ -19,7 +19,7 @@ namespace Saviour_Backup_System
InitializeComponent();
populateDropdown();
assignToolTips();
this.Size = new Size(583, 299);
this.Size = new Size(583, 269);
}
private void assignToolTips() {
@ -32,10 +32,9 @@ namespace Saviour_Backup_System
//huge list of tooltips to use!
tempTip.SetToolTip(this.backupNameInput, "Name the backup\nAn easy name for the backup, or even a description.");
tempTip.SetToolTip(this.drivesDropdown, "Select the drive\nWhich drive would you like to backup?");
tempTip.SetToolTip(this.compressionTypeDropdown, "Compression?\nWould you like to compress the backup to save space on your computer?");
tempTip.SetToolTip(this.previousBackupInput, "Previous backups\nHow many past backups would you like to store, enter -1 for all");
tempTip.SetToolTip(this.insertionSwitch, "Automated\nWould you like to backup the drive as soon as it is inserted to the computer?");
tempTip.SetToolTip(this.unifiedFileSwitch, "Single File\nWould you like to store the backup in a single file?");
tempTip.SetToolTip(this.compressionSwitch, "Single File\nWould you like to store the backup in a single file?");
tempTip.SetToolTip(this.folderPath, "Location\nWhere would you like to store the backup?");
tempTip.SetToolTip(this.createButton, "Let's Go!\nClick to create the backup record, this can take a few seconds to run.");
tempTip.SetToolTip(this.directoryBrowseButton, "Where?\nClick here to browse your computer to find where to store the backup.");
@ -63,9 +62,8 @@ namespace Saviour_Backup_System
{
backupNameInput.Text = "";
drivesDropdown.Text = "";
compressionTypeDropdown.Text = "";
insertionSwitch.Value = false;
unifiedFileSwitch.Value = false;
compressionSwitch.Value = false;
previousBackupInput.Value = 0;
folderPath.Text = "";
}
@ -73,24 +71,23 @@ namespace Saviour_Backup_System
{
backupNameInput.ReadOnly = state;
drivesDropdown.Enabled = !state;
compressionTypeDropdown.Enabled = !state;
insertionSwitch.IsReadOnly = state;
unifiedFileSwitch.IsReadOnly = state;
compressionSwitch.IsReadOnly = state;
previousBackupInput.Enabled = !state;
folderPath.ReadOnly = state;
}
private void createButton_Click(object sender, EventArgs e) {
DriveInfo drive = USBTools.getDriveObject(drivesDropdown.Text.Substring(0, 1));
lockControls(true);
if ((folderPath.Text == "") || (previousBackupInput.Text == "") || (compressionTypeDropdown.Text == "") || (drivesDropdown.Text == "") || (backupNameInput.Text == "")) {
if ((folderPath.Text == "") || (previousBackupInput.Text == "") ||(drivesDropdown.Text == "") || (backupNameInput.Text == "")) {
MessageBox.Show("You have not filled in every element, Please try again!", "Not everything is complete", MessageBoxButtons.OK, MessageBoxIcon.Error);
lockControls(false);
return;
}
statusProgress.Text = "Initialising...";
int initHeight = 299;
while (this.Size.Height != 330) {
int initHeight = 269;
while (this.Size.Height != 302) {
initHeight++;
this.Size = new Size(583, initHeight);
Thread.Sleep(10);
@ -105,9 +102,6 @@ namespace Saviour_Backup_System
MessageBox.Show("Error Creating Folder! Please check the path and try agian.", "Error creating folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
else if (compressionTypeDropdown.Text == "None" && unifiedFileSwitch.Value == true) {
MessageBox.Show("You cannot have a unified file without some form of compression, please select again.", "Compression Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} else if (drive.VolumeLabel == ""){
MessageBox.Show("You cannot backup a drive with no label, please rename it and try again","Can't use default name", MessageBoxButtons.OK, MessageBoxIcon.Error);
} else {
@ -120,7 +114,7 @@ namespace Saviour_Backup_System
clearControls();
this.Close();
}
while (this.Size.Height != 299) {
while (this.Size.Height != 269) {
initHeight--;
this.Size = new Size(583, initHeight);
Thread.Sleep(10);
@ -164,7 +158,7 @@ namespace Saviour_Backup_System
cmd.Parameters["Creation Date"].Value = tools.getUnixTimeStamp();
cmd.Parameters["Backup Location"].Value = folderPath.Text;
cmd.Parameters["Automatic"].Value = insertionSwitch.Value;
cmd.Parameters["Compression"].Value = unifiedFileSwitch.Value;
cmd.Parameters["Compression"].Value = compressionSwitch.Value;
cmd.Parameters["Previous Backups"].Value = previousBackupInput.Value;
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
@ -175,6 +169,12 @@ namespace Saviour_Backup_System
private void insertionSwitch_Click(object sender, EventArgs e) { insertionSwitch.Value = !insertionSwitch.Value; }
private void unifiedFileSwitch_Click(object sender, EventArgs e) { unifiedFileSwitch.Value = !unifiedFileSwitch.Value; }
private void unifiedFileSwitch_Click(object sender, EventArgs e) {
compressionSwitch.Value = !compressionSwitch.Value;
if(compressionSwitch.Value) {
DialogResult result = MessageBox.Show("Compression can take a long time to complete, and your computer will need to be on all this time.\nAre you sure you want to do this?", "Compression Time Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
compressionSwitch.Value = (result == System.Windows.Forms.DialogResult.Yes);
}
}
}
}