From 2d49d5c9a85cc77ed0d0a2c7f66e36b007270aa3 Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Fri, 14 Jun 2024 21:29:53 -0400 Subject: [PATCH] Bug fix --- RecodeItGUI/GUI/Main.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index 58ce604..b02e53c 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -11,11 +11,15 @@ public partial class ReCodeItForm : Form private RemapModel CurrentRemap { get; set; } + private int _selectedRemapTreeIndex = 0; + public ReCodeItForm() { InitializeComponent(); PopulateDomainUpDowns(); + RemapTreeView.NodeMouseDoubleClick += EditSelectedRemap; + Remapper.OnComplete += ReloadTreeView; ReloadTreeView(this, EventArgs.Empty); } @@ -121,7 +125,7 @@ public partial class ReCodeItForm : Form private void EditRemapButton_Click(object sender, EventArgs e) { - EditSelectedRemap(); + EditSelectedRemap(this, null); } private void RunRemapButton_Click(object sender, EventArgs e) @@ -482,10 +486,18 @@ public partial class ReCodeItForm : Form NestedTypesExcludeBox.Items.Clear(); } - private void EditSelectedRemap() + private void EditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e) { + if (e?.Node.Level != 0) + { + return; + } + + _selectedRemapTreeIndex = RemapTreeView.SelectedNode.Index; + ResetAll(); - var remap = DataProvider.Remaps.ElementAt(RemapTreeView.SelectedNode.Index); + + var remap = DataProvider.Remaps.ElementAt(_selectedRemapTreeIndex); NewTypeName.Text = remap.NewTypeName; OriginalTypeName.Text = remap.OriginalTypeName;