Exemplo n.º 1
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;
        }