void ShowNextImage() { passMouseLeave = true; int titleBarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height; Cursor.Position = new Point(this.Location.X + panel1.Location.X + panel1.Width / 2, this.Location.Y + panel1.Location.Y + panel1.Height / 2); if (imagePool != null && imagePool.Count > 0) { if (nextImageIsPractice) { int nextImageIndex = new Random().Next(0, imagePool.Count - 1); currentExperimentImage = practiceImages[imagePool[nextImageIndex]]; imagePool.RemoveAt(nextImageIndex); if (!(imagePool.Count > 0)) { //No test img nextImageIsPractice = false; imagePool = new List <string>(); imagePool.AddRange(testImages.Keys); } } else { int nextImageIndex = new Random().Next(0, imagePool.Count - 1); currentExperimentImage = testImages[imagePool[nextImageIndex]]; imagePool.RemoveAt(nextImageIndex); if (!(imagePool.Count > 0)) { experimentEnded = true; } } } pictureBox.Image = currentExperimentImage.image; decisionFlag = true; }
void AddImagesTo(ref Dictionary <string, ExperimentImage> imageDictionary, ExperimentImage eImage) { imageDictionary.Add(eImage.name, eImage); }