From 95207c70b30ca39ed4323d57762f70eff9f80750 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 20 Nov 2017 15:51:50 -0500 Subject: [PATCH] Checking a duplicate entry in the Test Merge Manager will automatically uncheck the other --- TGS.ControlPanel/TestMergeManager.cs | 30 +++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/TGS.ControlPanel/TestMergeManager.cs b/TGS.ControlPanel/TestMergeManager.cs index f609142431..115151a459 100644 --- a/TGS.ControlPanel/TestMergeManager.cs +++ b/TGS.ControlPanel/TestMergeManager.cs @@ -48,6 +48,31 @@ namespace TGS.ControlPanel currentInterface = interfaceToUse; client = clientToUse; Load += PullRequestManager_Load; + PullRequestListBox.ItemCheck += PullRequestListBox_ItemCheck; + } + + /// + /// Called when an item in is checked or unchecked. Unchecks opposing PRs + /// + /// The sender of the event + /// The + void PullRequestListBox_ItemCheck(object sender, ItemCheckEventArgs e) + { + if (e.NewValue != CheckState.Checked) + return; + //let's uncheck the opposing PR# if this is one of the outdated/updated testmerge + var item = (string)PullRequestListBox.Items[e.Index]; + var prefix = item.Split(' ')[0]; + + for (var I = 0; I < PullRequestListBox.Items.Count; ++I) + { + var S = (string)PullRequestListBox.Items[I]; + if (S.Split(' ')[0] == prefix && S != item) + { + PullRequestListBox.SetItemChecked(I, false); + break; + } + } } /// @@ -305,11 +330,6 @@ namespace TGS.ControlPanel LoadPullRequests(); } - bool PullRequestsStringsListContainsPRNumber(CheckedListBox.ObjectCollection items, int PRNumber) - { - return false; - } - /// /// Called when the is clicked. Adds the PR with the number in to or shows an error prompt if it doesn't/already exists ///