Tweaked the profile manager because I just can't leave well enough alone. Now it will name the folder group based on the path chosen, the user has no control over this.

This commit is contained in:
Admin
2020-11-09 11:41:04 -06:00
parent 297b70c76c
commit 9f090b0539
3 changed files with 33 additions and 59 deletions
Binary file not shown.
+17 -39
View File
@@ -35,8 +35,6 @@
this.ProfileInfoPanel = new System.Windows.Forms.Panel(); this.ProfileInfoPanel = new System.Windows.Forms.Panel();
this.ProfileInfoGroupBox = new System.Windows.Forms.GroupBox(); this.ProfileInfoGroupBox = new System.Windows.Forms.GroupBox();
this.InsertGroupName = new System.Windows.Forms.Button(); this.InsertGroupName = new System.Windows.Forms.Button();
this.FolderGroupNameTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.DeleteProfileButton = new System.Windows.Forms.Button(); this.DeleteProfileButton = new System.Windows.Forms.Button();
this.MachineNameTextBox = new System.Windows.Forms.TextBox(); this.MachineNameTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
@@ -71,7 +69,7 @@
this.MainLayoutPanel.RowCount = 2; this.MainLayoutPanel.RowCount = 2;
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F)); this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F)); this.MainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F));
this.MainLayoutPanel.Size = new System.Drawing.Size(627, 809); this.MainLayoutPanel.Size = new System.Drawing.Size(627, 741);
this.MainLayoutPanel.TabIndex = 0; this.MainLayoutPanel.TabIndex = 0;
// //
// MainPanel // MainPanel
@@ -81,7 +79,7 @@
this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainPanel.Location = new System.Drawing.Point(3, 3); this.MainPanel.Location = new System.Drawing.Point(3, 3);
this.MainPanel.Name = "MainPanel"; this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(621, 115); this.MainPanel.Size = new System.Drawing.Size(621, 105);
this.MainPanel.TabIndex = 0; this.MainPanel.TabIndex = 0;
// //
// ProfilesComboBox // ProfilesComboBox
@@ -96,7 +94,7 @@
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(23, 47); this.label3.Location = new System.Drawing.Point(16, 47);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 20); this.label3.Size = new System.Drawing.Size(65, 20);
this.label3.TabIndex = 7; this.label3.TabIndex = 7;
@@ -106,9 +104,9 @@
// //
this.ProfileInfoPanel.Controls.Add(this.ProfileInfoGroupBox); this.ProfileInfoPanel.Controls.Add(this.ProfileInfoGroupBox);
this.ProfileInfoPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.ProfileInfoPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProfileInfoPanel.Location = new System.Drawing.Point(3, 124); this.ProfileInfoPanel.Location = new System.Drawing.Point(3, 114);
this.ProfileInfoPanel.Name = "ProfileInfoPanel"; this.ProfileInfoPanel.Name = "ProfileInfoPanel";
this.ProfileInfoPanel.Size = new System.Drawing.Size(621, 682); this.ProfileInfoPanel.Size = new System.Drawing.Size(621, 624);
this.ProfileInfoPanel.TabIndex = 1; this.ProfileInfoPanel.TabIndex = 1;
// //
// ProfileInfoGroupBox // ProfileInfoGroupBox
@@ -118,8 +116,6 @@
this.ProfileInfoGroupBox.Controls.Add(this.FolderGroupPathTextBox); this.ProfileInfoGroupBox.Controls.Add(this.FolderGroupPathTextBox);
this.ProfileInfoGroupBox.Controls.Add(this.label6); this.ProfileInfoGroupBox.Controls.Add(this.label6);
this.ProfileInfoGroupBox.Controls.Add(this.InsertGroupName); this.ProfileInfoGroupBox.Controls.Add(this.InsertGroupName);
this.ProfileInfoGroupBox.Controls.Add(this.FolderGroupNameTextBox);
this.ProfileInfoGroupBox.Controls.Add(this.label5);
this.ProfileInfoGroupBox.Controls.Add(this.DeleteProfileButton); this.ProfileInfoGroupBox.Controls.Add(this.DeleteProfileButton);
this.ProfileInfoGroupBox.Controls.Add(this.MachineNameTextBox); this.ProfileInfoGroupBox.Controls.Add(this.MachineNameTextBox);
this.ProfileInfoGroupBox.Controls.Add(this.label4); this.ProfileInfoGroupBox.Controls.Add(this.label4);
@@ -133,7 +129,7 @@
this.ProfileInfoGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; this.ProfileInfoGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProfileInfoGroupBox.Location = new System.Drawing.Point(0, 0); this.ProfileInfoGroupBox.Location = new System.Drawing.Point(0, 0);
this.ProfileInfoGroupBox.Name = "ProfileInfoGroupBox"; this.ProfileInfoGroupBox.Name = "ProfileInfoGroupBox";
this.ProfileInfoGroupBox.Size = new System.Drawing.Size(621, 682); this.ProfileInfoGroupBox.Size = new System.Drawing.Size(621, 624);
this.ProfileInfoGroupBox.TabIndex = 0; this.ProfileInfoGroupBox.TabIndex = 0;
this.ProfileInfoGroupBox.TabStop = false; this.ProfileInfoGroupBox.TabStop = false;
this.ProfileInfoGroupBox.Text = "Profile Information"; this.ProfileInfoGroupBox.Text = "Profile Information";
@@ -141,7 +137,7 @@
// InsertGroupName // InsertGroupName
// //
this.InsertGroupName.Enabled = false; this.InsertGroupName.Enabled = false;
this.InsertGroupName.Location = new System.Drawing.Point(518, 429); this.InsertGroupName.Location = new System.Drawing.Point(518, 350);
this.InsertGroupName.Name = "InsertGroupName"; this.InsertGroupName.Name = "InsertGroupName";
this.InsertGroupName.Size = new System.Drawing.Size(86, 39); this.InsertGroupName.Size = new System.Drawing.Size(86, 39);
this.InsertGroupName.TabIndex = 8; this.InsertGroupName.TabIndex = 8;
@@ -149,26 +145,10 @@
this.InsertGroupName.UseVisualStyleBackColor = true; this.InsertGroupName.UseVisualStyleBackColor = true;
this.InsertGroupName.Click += new System.EventHandler(this.InsertGroupName_Click); this.InsertGroupName.Click += new System.EventHandler(this.InsertGroupName_Click);
// //
// FolderGroupNameTextBox
//
this.FolderGroupNameTextBox.Location = new System.Drawing.Point(201, 286);
this.FolderGroupNameTextBox.Name = "FolderGroupNameTextBox";
this.FolderGroupNameTextBox.Size = new System.Drawing.Size(311, 26);
this.FolderGroupNameTextBox.TabIndex = 5;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(16, 289);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(153, 20);
this.label5.TabIndex = 9;
this.label5.Text = "Folder Group Name:";
//
// DeleteProfileButton // DeleteProfileButton
// //
this.DeleteProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.DeleteProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.DeleteProfileButton.Location = new System.Drawing.Point(9, 633); this.DeleteProfileButton.Location = new System.Drawing.Point(20, 575);
this.DeleteProfileButton.Name = "DeleteProfileButton"; this.DeleteProfileButton.Name = "DeleteProfileButton";
this.DeleteProfileButton.Size = new System.Drawing.Size(75, 40); this.DeleteProfileButton.Size = new System.Drawing.Size(75, 40);
this.DeleteProfileButton.TabIndex = 8; this.DeleteProfileButton.TabIndex = 8;
@@ -212,7 +192,7 @@
// AddOrUpdateProfileButton // AddOrUpdateProfileButton
// //
this.AddOrUpdateProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.AddOrUpdateProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AddOrUpdateProfileButton.Location = new System.Drawing.Point(518, 633); this.AddOrUpdateProfileButton.Location = new System.Drawing.Point(518, 575);
this.AddOrUpdateProfileButton.Name = "AddOrUpdateProfileButton"; this.AddOrUpdateProfileButton.Name = "AddOrUpdateProfileButton";
this.AddOrUpdateProfileButton.Size = new System.Drawing.Size(86, 40); this.AddOrUpdateProfileButton.Size = new System.Drawing.Size(86, 40);
this.AddOrUpdateProfileButton.TabIndex = 9; this.AddOrUpdateProfileButton.TabIndex = 9;
@@ -231,7 +211,7 @@
// //
// SelectNewContentLocationButton // SelectNewContentLocationButton
// //
this.SelectNewContentLocationButton.Location = new System.Drawing.Point(518, 111); this.SelectNewContentLocationButton.Location = new System.Drawing.Point(518, 109);
this.SelectNewContentLocationButton.Name = "SelectNewContentLocationButton"; this.SelectNewContentLocationButton.Name = "SelectNewContentLocationButton";
this.SelectNewContentLocationButton.Size = new System.Drawing.Size(50, 30); this.SelectNewContentLocationButton.Size = new System.Drawing.Size(50, 30);
this.SelectNewContentLocationButton.TabIndex = 3; this.SelectNewContentLocationButton.TabIndex = 3;
@@ -241,7 +221,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(16, 115); this.label2.Location = new System.Drawing.Point(16, 111);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(170, 20); this.label2.Size = new System.Drawing.Size(170, 20);
this.label2.TabIndex = 2; this.label2.TabIndex = 2;
@@ -249,7 +229,7 @@
// //
// NewContentLocationTextBox // NewContentLocationTextBox
// //
this.NewContentLocationTextBox.Location = new System.Drawing.Point(201, 113); this.NewContentLocationTextBox.Location = new System.Drawing.Point(201, 109);
this.NewContentLocationTextBox.Name = "NewContentLocationTextBox"; this.NewContentLocationTextBox.Name = "NewContentLocationTextBox";
this.NewContentLocationTextBox.Size = new System.Drawing.Size(311, 26); this.NewContentLocationTextBox.Size = new System.Drawing.Size(311, 26);
this.NewContentLocationTextBox.TabIndex = 2; this.NewContentLocationTextBox.TabIndex = 2;
@@ -257,7 +237,7 @@
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(16, 339); this.label6.Location = new System.Drawing.Point(16, 287);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(144, 20); this.label6.Size = new System.Drawing.Size(144, 20);
this.label6.TabIndex = 11; this.label6.TabIndex = 11;
@@ -265,14 +245,14 @@
// //
// FolderGroupPathTextBox // FolderGroupPathTextBox
// //
this.FolderGroupPathTextBox.Location = new System.Drawing.Point(201, 336); this.FolderGroupPathTextBox.Location = new System.Drawing.Point(201, 284);
this.FolderGroupPathTextBox.Name = "FolderGroupPathTextBox"; this.FolderGroupPathTextBox.Name = "FolderGroupPathTextBox";
this.FolderGroupPathTextBox.Size = new System.Drawing.Size(311, 26); this.FolderGroupPathTextBox.Size = new System.Drawing.Size(311, 26);
this.FolderGroupPathTextBox.TabIndex = 6; this.FolderGroupPathTextBox.TabIndex = 6;
// //
// FolderGroupPathButton // FolderGroupPathButton
// //
this.FolderGroupPathButton.Location = new System.Drawing.Point(518, 334); this.FolderGroupPathButton.Location = new System.Drawing.Point(518, 284);
this.FolderGroupPathButton.Name = "FolderGroupPathButton"; this.FolderGroupPathButton.Name = "FolderGroupPathButton";
this.FolderGroupPathButton.Size = new System.Drawing.Size(50, 30); this.FolderGroupPathButton.Size = new System.Drawing.Size(50, 30);
this.FolderGroupPathButton.TabIndex = 7; this.FolderGroupPathButton.TabIndex = 7;
@@ -287,7 +267,7 @@
this.PathColumn}); this.PathColumn});
this.FolderGroupListView.FullRowSelect = true; this.FolderGroupListView.FullRowSelect = true;
this.FolderGroupListView.HideSelection = false; this.FolderGroupListView.HideSelection = false;
this.FolderGroupListView.Location = new System.Drawing.Point(20, 407); this.FolderGroupListView.Location = new System.Drawing.Point(20, 350);
this.FolderGroupListView.MultiSelect = false; this.FolderGroupListView.MultiSelect = false;
this.FolderGroupListView.Name = "FolderGroupListView"; this.FolderGroupListView.Name = "FolderGroupListView";
this.FolderGroupListView.Size = new System.Drawing.Size(492, 220); this.FolderGroupListView.Size = new System.Drawing.Size(492, 220);
@@ -310,7 +290,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(627, 809); this.ClientSize = new System.Drawing.Size(627, 741);
this.Controls.Add(this.MainLayoutPanel); this.Controls.Add(this.MainLayoutPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false; this.MaximizeBox = false;
@@ -348,8 +328,6 @@
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button DeleteProfileButton; private System.Windows.Forms.Button DeleteProfileButton;
private System.Windows.Forms.Button InsertGroupName; private System.Windows.Forms.Button InsertGroupName;
private System.Windows.Forms.TextBox FolderGroupNameTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button FolderGroupPathButton; private System.Windows.Forms.Button FolderGroupPathButton;
private System.Windows.Forms.TextBox FolderGroupPathTextBox; private System.Windows.Forms.TextBox FolderGroupPathTextBox;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
+5 -9
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -30,7 +31,6 @@ namespace DataOrganizer
NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton; NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton;
MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged; MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged;
FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton; FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton;
FolderGroupNameTextBox.TextChanged += ToggleGroupInsertButton;
FolderGroupListView.MouseClick += FolderGroupListView_MouseClick; FolderGroupListView.MouseClick += FolderGroupListView_MouseClick;
deleteMenuItem.Click += DeleteMenuItem_Click; deleteMenuItem.Click += DeleteMenuItem_Click;
@@ -90,7 +90,7 @@ namespace DataOrganizer
private void ToggleGroupInsertButton(object sender, EventArgs e) private void ToggleGroupInsertButton(object sender, EventArgs e)
{ {
if (!string.IsNullOrEmpty(FolderGroupNameTextBox.Text) && !string.IsNullOrEmpty(FolderGroupPathTextBox.Text)) if (!string.IsNullOrEmpty(FolderGroupPathTextBox.Text))
InsertGroupName.Enabled = true; InsertGroupName.Enabled = true;
else else
InsertGroupName.Enabled = false; InsertGroupName.Enabled = false;
@@ -207,10 +207,9 @@ namespace DataOrganizer
private void InsertGroupName_Click(object sender, EventArgs e) private void InsertGroupName_Click(object sender, EventArgs e)
{ {
var groupName = FolderGroupNameTextBox.Text.Trim(); var dir = new DirectoryInfo(FolderGroupPathTextBox.Text);
var groupName = dir.Name;
if(!string.IsNullOrEmpty(groupName))
{
if (!FolderGroupListView.Items.ContainsKey(groupName))//!FolderGroupsTreeView.Nodes.ContainsKey(groupName)) if (!FolderGroupListView.Items.ContainsKey(groupName))//!FolderGroupsTreeView.Nodes.ContainsKey(groupName))
{ {
var item = new ListViewItem(groupName); var item = new ListViewItem(groupName);
@@ -218,7 +217,6 @@ namespace DataOrganizer
FolderGroupListView.Items.Add(item); FolderGroupListView.Items.Add(item);
if (IsUpdating) if (IsUpdating)
{ {
var db = new DB(); var db = new DB();
@@ -230,11 +228,9 @@ namespace DataOrganizer
profile.FolderGroups.Add(new DB.FolderGroup { Name = groupName, Id = newId, Path = FolderGroupPathTextBox.Text }); profile.FolderGroups.Add(new DB.FolderGroup { Name = groupName, Id = newId, Path = FolderGroupPathTextBox.Text });
} }
} }
}
FolderGroupNameTextBox.Text = string.Empty;
FolderGroupPathTextBox.Text = string.Empty; FolderGroupPathTextBox.Text = string.Empty;
FolderGroupNameTextBox.Focus(); FolderGroupPathButton.Focus();
} }
private bool GetCurrentProfile(out DB.Profile profile) private bool GetCurrentProfile(out DB.Profile profile)