Checking a duplicate entry in the Test Merge Manager will automatically uncheck the other

This commit is contained in:
Cyberboss
2017-11-20 15:51:50 -05:00
parent d8476f9caf
commit 95207c70b3
+25 -5
View File
@@ -48,6 +48,31 @@ namespace TGS.ControlPanel
currentInterface = interfaceToUse;
client = clientToUse;
Load += PullRequestManager_Load;
PullRequestListBox.ItemCheck += PullRequestListBox_ItemCheck;
}
/// <summary>
/// Called when an item in <see cref="PullRequestListBox"/> is checked or unchecked. Unchecks opposing PRs
/// </summary>
/// <param name="sender">The sender of the event</param>
/// <param name="e">The <see cref="ItemCheckEventArgs"/></param>
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;
}
}
}
/// <summary>
@@ -305,11 +330,6 @@ namespace TGS.ControlPanel
LoadPullRequests();
}
bool PullRequestsStringsListContainsPRNumber(CheckedListBox.ObjectCollection items, int PRNumber)
{
return false;
}
/// <summary>
/// Called when the <see cref="AddPRButton"/> is clicked. Adds the PR with the number in <see cref="AddPRNumericUpDown"/> to <see cref="PullRequestListBox"/> or shows an error prompt if it doesn't/already exists
/// </summary>