public void AddCaptures(List <int[]> parameters, List <int> ind, List <string> folders) { MainCapture mc = new MainCapture(); List <Image> samples = new List <Image>(); samples = mc.Samples(folders, ind); for (int i = 0; i < parameters.Count; i++) { capturesList.Add(new CaptureWindow(this, samples.ElementAt(i), parameters.ElementAt(parameters.Count - 1 - i), folders.ElementAt(folders.Count - 1 - i))); capturesList.ElementAt(i).Uid = (i).ToString(); samplesList.Add(samples.ElementAt(i)); samplesList.ElementAt(i).Uid = (i).ToString(); numberCapturesRunning++; } sampleSP.Children.Clear(); sampleSP.Children.Add(samplesList.ElementAt(0)); infoLabel.Content = "1/" + capturesList.Count.ToString(); MainPage.capturesRunning = true; Border1.Visibility = Visibility.Visible; Border2.Visibility = Visibility.Visible; sampleSP.Visibility = Visibility.Visible; infoLabel.Visibility = Visibility.Visible; ShowButton.IsEnabled = true; }
// Parameters are received from MainPage listing the features of the new captures to be built // In this method they are built and added to the UI public void AddCaptures(List <int[]> parameters, List <int> ind, List <string> folders, List <bool[]> analysis, List <string> names, List <PcPhysicalPoint> locations, List <System.Drawing.Point> sizes, List <string> maps) { MainCapture mc = new MainCapture(); List <Image> samples = new List <Image>(); List <IPcOutline> outlines; object[] returnable = new object[3]; returnable = mc.Samples(folders, ind, locations, sizes); samples = (List <Image>)returnable[0]; outlines = (List <IPcOutline>)returnable[1]; List <int> moved = (List <int>)returnable[2]; // Capture Window holds the control of a process. int previousCaptures = capturesList.Count; for (int i = 0; i < parameters.Count; i++) { if (moved[i] != 2) { PcPhysicalPoint location = new PcPhysicalPoint(outlines[i].PhysicalBoundaries.Location.X * (outlines[i].PixelDensity.X), outlines[i].PhysicalBoundaries.Location.Y * (outlines[i].PixelDensity.Y)); System.Drawing.Point size = new System.Drawing.Point(Convert.ToInt32(PictureHandling.GetOutlineWidth(outlines[i])), Convert.ToInt32(PictureHandling.GetOutlineHeight(outlines[i]))); if (moved[i] == 0) { capturesList.Add(new CaptureWindow(this, samples.ElementAt(i), parameters.ElementAt(parameters.Count - 1 - i), folders.ElementAt(folders.Count - 1 - i), analysis.ElementAt(analysis.Count - 1 - i), names.ElementAt(names.Count - 1 - i), location, size, false, maps.ElementAt(maps.Count - 1 - i))); } else { capturesList.Add(new CaptureWindow(this, samples.ElementAt(i), parameters.ElementAt(parameters.Count - 1 - i), folders.ElementAt(folders.Count - 1 - i), analysis.ElementAt(analysis.Count - 1 - i), names.ElementAt(names.Count - 1 - i), location, size, true, maps.ElementAt(maps.Count - 1 - i))); } capturesList.ElementAt(i + previousCaptures).Uid = (i + previousCaptures).ToString(); samplesList.Add(samples.ElementAt(i)); samplesList.ElementAt(i + previousCaptures).Uid = (i + previousCaptures).ToString(); capturesNames.Add(names.ElementAt(names.Count - 1 - i)); numberCapturesRunning++; } else { MessageBox.Show("Capture of process " + names.ElementAt(names.Count - 1 - i) + " could not be accomplished. Object not found."); return; } } // UI modification according to new situation sampleSP.Children.Clear(); sampleSP.Children.Add(samplesList.ElementAt(0)); infoLabel.Content = "Process 1/" + capturesList.Count.ToString(); if (capturesList.Count >= 2) { rightSp.Visibility = Visibility.Visible; leftSp.Visibility = Visibility.Visible; } MainPage.capturesRunning = true; Border1.Visibility = Visibility.Visible; Border2.Visibility = Visibility.Visible; sampleSP.Visibility = Visibility.Visible; infoLabel.Visibility = Visibility.Visible; nameLabel.Visibility = Visibility.Visible; ShowButton.IsEnabled = true; // If this is the first time if (parameters.Count == capturesList.Count) { ArtificialScroll(); } }