// Gets the next index in the itemPairList private void populateGroupBox(List <ItemPair> listItemPairList, int itemPairListIndex) { if (itemPairListIndex > listItemPairList.Count - 1) { testDone = true; // write to test session table List <TestSession> testSessionList = new List <TestSession>(); currentTestSession.intUserID = currentUser.intUserID; currentTestSession.intTestID = currentTest.TestID; // Need to change this for sprint 2 currentTestSession.datetimeCreationDate = DateTime.Now; TestSession.CreateSession(currentTestSession); int sessionID = currentTestSession.intSessionID; foreach (var currentSesResult in allCurrentResults) { currentSesResult.intSessionID = sessionID; Result.CreateSession(currentSesResult); } userChoiceOne.Visible = false; userChoiceTwo.Visible = false; userChoiceThree.Visible = false; finishedLabel.Visible = true; testButton.Visible = false; } else { // Populate groupbox radio buttons with itempair by index ItemPair newItemPair = new ItemPair(); newItemPair = itemPairList[itemPairListIndex]; if (currentTest.Shuffle == 1) { //if custom test is set to Shuffle, will randomize order of pairings itemToAssign = populateRadio(newItemPair); } else { itemToAssign.Clear(); itemToAssign.Add(newItemPair.Item1); itemToAssign.Add(newItemPair.Item2); itemToAssign.Add(new Item(0, "Undecided", currentTest.TestID)); if (currentTest.TestType == "T") { userChoiceOne.Text = newItemPair.Item1.Name; userChoiceTwo.Text = newItemPair.Item2.Name; userChoiceThree.Text = "Undecided"; } else if (currentTest.TestType == "I") { if (itemToAssign[0].ItemImage != null) { userChoiceOne.Text = null; userChoiceOne.TextImageRelation = TextImageRelation.TextAboveImage; userChoiceOne.Image = itemToAssign[0].getImage(); } else { userChoiceOne.Image = null; } if (itemToAssign[1].ItemImage != null) { userChoiceTwo.Text = null; userChoiceTwo.TextImageRelation = TextImageRelation.TextAboveImage; userChoiceTwo.Image = itemToAssign[1].getImage(); } else { userChoiceTwo.Image = null; } userChoiceThree.TextImageRelation = TextImageRelation.TextAboveImage; userChoiceThree.Image = Properties.Resources.Undecided; userChoiceThree.Text = null; } else if (currentTest.TestType == "TI") { if (itemToAssign[0].ItemImage != null) { userChoiceOne.TextImageRelation = TextImageRelation.TextAboveImage; userChoiceOne.Image = itemToAssign[0].getImage(); } else { userChoiceOne.Image = null; } if (itemToAssign[1].ItemImage != null) { userChoiceTwo.TextImageRelation = TextImageRelation.TextAboveImage; userChoiceTwo.Image = itemToAssign[1].getImage(); } else { userChoiceTwo.Image = null; } userChoiceThree.TextImageRelation = TextImageRelation.TextAboveImage; userChoiceOne.Text = newItemPair.Item1.Name; userChoiceTwo.Text = newItemPair.Item2.Name; userChoiceThree.Text = "Undecided"; userChoiceThree.Image = Properties.Resources.Undecided; } } userChoiceOne.Checked = false; userChoiceTwo.Checked = false; userChoiceThree.Checked = false; // Load numerator for progress bar numeratorChange(itemPairList.Count, itemPairListIndex); } }