Fixed up the profile manager form, added back all broken functions I forgot about after changing over the TreeView into a ListView.

This commit is contained in:
Admin
2020-11-09 11:20:35 -06:00
parent 09ef449909
commit 297b70c76c
5 changed files with 15 additions and 11 deletions
Binary file not shown.
+1
View File
@@ -204,6 +204,7 @@
this.Controls.Add(this.MainMenu); this.Controls.Add(this.MainMenu);
this.MainMenuStrip = this.MainMenu; this.MainMenuStrip = this.MainMenu;
this.Name = "FileViewer"; this.Name = "FileViewer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "File Viewer & Comparison"; this.Text = "File Viewer & Comparison";
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.PanelOne.ResumeLayout(false); this.PanelOne.ResumeLayout(false);
+1
View File
@@ -94,6 +94,7 @@
this.Controls.Add(this.MainMenu); this.Controls.Add(this.MainMenu);
this.MainMenuStrip = this.MainMenu; this.MainMenuStrip = this.MainMenu;
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1"; this.Text = "Form1";
this.MainMenu.ResumeLayout(false); this.MainMenu.ResumeLayout(false);
this.MainMenu.PerformLayout(); this.MainMenu.PerformLayout();
+2
View File
@@ -285,6 +285,7 @@
this.FolderGroupListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.FolderGroupListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.NameColumn, this.NameColumn,
this.PathColumn}); this.PathColumn});
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, 407);
this.FolderGroupListView.MultiSelect = false; this.FolderGroupListView.MultiSelect = false;
@@ -316,6 +317,7 @@
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "ProfileManager"; this.Name = "ProfileManager";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Profile Manager"; this.Text = "Profile Manager";
this.MainLayoutPanel.ResumeLayout(false); this.MainLayoutPanel.ResumeLayout(false);
this.MainPanel.ResumeLayout(false); this.MainPanel.ResumeLayout(false);
+9 -9
View File
@@ -13,10 +13,10 @@ namespace DataOrganizer
{ {
public partial class ProfileManager : Form public partial class ProfileManager : Form
{ {
private string MachineNameLabelText { get; } = "The Machine Name property determines what\r\nprofile will be loaded automatically (Currently: '{0}')."; private string MachineNameLabelText { get; } = "The Machine Name property determines what profile will be loaded automatically.\r\nCurrently: '{0}'.";
private bool IsUpdating { get; set; } private bool IsUpdating { get; set; }
private ContextMenu FolderGroupListContextMenu { get; set; } = new ContextMenu(); private ContextMenu FolderGroupListContextMenu { get; set; } = new ContextMenu();
private TreeNode ClickedNode { get; set; } private ListViewItem SelectedItem { get; set; }
public ProfileManager() public ProfileManager()
{ {
@@ -29,20 +29,20 @@ namespace DataOrganizer
ProfileNameTextBox.TextChanged += ToggleAddOrUpdateButton; ProfileNameTextBox.TextChanged += ToggleAddOrUpdateButton;
NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton; NewContentLocationTextBox.TextChanged += ToggleAddOrUpdateButton;
MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged; MachineNameTextBox.TextChanged += MachineNameTextBox_TextChanged;
//FolderGroupsTreeView.NodeMouseClick += FolderGroupsTreeView_NodeMouseClick;
FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton; FolderGroupPathTextBox.TextChanged += ToggleGroupInsertButton;
FolderGroupNameTextBox.TextChanged += ToggleGroupInsertButton; FolderGroupNameTextBox.TextChanged += ToggleGroupInsertButton;
FolderGroupListView.MouseClick += FolderGroupListView_MouseClick;
deleteMenuItem.Click += DeleteMenuItem_Click; deleteMenuItem.Click += DeleteMenuItem_Click;
UpdateProfileComboBox(); UpdateProfileComboBox();
} }
private void FolderGroupsTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) private void FolderGroupListView_MouseClick(object sender, MouseEventArgs e)
{ {
if(e.Button == MouseButtons.Right) if(e.Button == MouseButtons.Right)
{ {
ClickedNode = e.Node; SelectedItem = FolderGroupListView.GetItemAt(e.X, e.Y);
//FolderGroupListContextMenu.Show(FolderGroupsTreeView, e.Location); FolderGroupListContextMenu.Show(FolderGroupListView, e.Location);
} }
} }
@@ -57,7 +57,7 @@ namespace DataOrganizer
var db = new DB(); var db = new DB();
var currentIndex = ProfilesComboBox.SelectedIndex; var currentIndex = ProfilesComboBox.SelectedIndex;
db.DeleteFolderGroup((DB.FolderGroup) ClickedNode.Tag); db.DeleteFolderGroup((DB.FolderGroup) SelectedItem.Tag);
UpdateProfileComboBox(); UpdateProfileComboBox();
@@ -67,10 +67,9 @@ namespace DataOrganizer
else else
{ {
FolderGroupListView.Items.Remove(FolderGroupListView.SelectedItems[0]); FolderGroupListView.Items.Remove(FolderGroupListView.SelectedItems[0]);
//FolderGroupsTreeView.Nodes.Remove(ClickedNode);
} }
ClickedNode = null; SelectedItem = null;
} }
private void MachineNameTextBox_TextChanged(object sender, EventArgs e) private void MachineNameTextBox_TextChanged(object sender, EventArgs e)
@@ -199,6 +198,7 @@ namespace DataOrganizer
{ {
var item = new ListViewItem(group.Name); var item = new ListViewItem(group.Name);
item.SubItems.Add(group.Path); item.SubItems.Add(group.Path);
item.Tag = group;
FolderGroupListView.Items.Add(item); FolderGroupListView.Items.Add(item);
} }