/// <summary> /// Checks the sequence for each unique measurement as analyses may reuse measurements already taken for others. /// </summary> public void PrepareForSequenceRunAll(object sender, EventArgs e) { // Calculate how many exposures are going to be required to run the sequence List <PatternSetup> PatternList = new List <PatternSetup>(); NumberOfSequenceExposures = 0; var sequence = TrueTest.get_Sequence(0); foreach (TrueTestEngine.SequenceItem SeqStep in sequence.Items) { if (!SeqStep.Selected) { continue; } PatternSetup ps = sequence.GetPatternSetupByName(SeqStep.PatternSetupName); if (ps == null) { continue; } // Check to see if we already counted this pattern's exposures bool RepeatPattern = false; foreach (PatternSetup P in PatternList) { if (P == ps) { RepeatPattern = true; break; } } if (!RepeatPattern) { PatternList.Add(ps); NumberOfSequenceExposures += 1; } } WriteToLog("This sequence will require " + NumberOfSequenceExposures + " camera exposures."); // Reset the number of exposures completed ExposuresCompleted = 0; }
private void Form1_Load(object sender, EventArgs e) { var calibrationDBResult = TrueTest.APIResultEnum.Success; var sequenceDBResult = TrueTest.APIResultEnum.Success; var measurementDBResult = TrueTest.APIResultEnum.Success; string calibrationDatabase = Properties.Settings.Default.CalibrationDatabase; string sequenceFileName = Properties.Settings.Default.SequenceXMLPathFileName; string measurementFileName = Properties.Settings.Default.MeasurementDatabasePathFileName; // Initialize TrueTest TrueTest.Initialize(ref calibrationDatabase, ref sequenceFileName, ref measurementFileName, this, //Give TrueTest a reference to the main application form (this) ref calibrationDBResult, ref sequenceDBResult, ref measurementDBResult); // The strings are passed in by reference, so if the user browses to select a new file during initialization, the values will be automatically updated // Therefore we still need to save My.Settings. Properties.Settings.Default.CalibrationDatabase = calibrationDatabase; Properties.Settings.Default.SequenceXMLPathFileName = sequenceFileName; Properties.Settings.Default.MeasurementDatabasePathFileName = measurementFileName; Properties.Settings.Default.Save(); // Add some event handlers to handle events coming from TrueTest AddTrueTestEventHandlers(); // Tells TrueTest to take measurements with the camera rather than retrieving measurements from the database TrueTest.OperatingMode = TrueTest.OperatingModeEnum.UseCamera; // Makes sure to save all results into the measurement database TrueTest.AppSettings().SaveAnalysisResultsToDatabase = true; // If the user wants to make a camera measurement, make sure it gets saved to the database TrueTest.SaveMeasurementsToDatabase = true; this.Text = TrueTest.get_Sequence().Name; }