示例#1
0
        // Selecting Acquire->Start on the main window will result in this function being called.
        // If numberOfScans == -1, the acquisitor will scan forever.
        public void AcquireStart(int numberOfScans)
        {
            if (appState != AppState.running)
            {
                if (profileManager.CurrentProfile == null)
                {
                    MessageBox.Show("No profile selected !", "Profile error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return;
                }
                Profile currentProfile = profileManager.GetCloneOfCurrentProfile();

                // clear stored data
                dataStore.ClearAll();

                // delete any temporary files
                string tempPath = Environment.GetEnvironmentVariable("TEMP") + "\\ScanMasterTemp";
                if (Directory.Exists(tempPath))
                {
                    string[] tempFiles = Directory.GetFiles(tempPath);
                    foreach (string file in tempFiles)
                    {
                        File.Delete(file);
                    }
                }

                // tell the viewers that acquisition is starting
                viewerManager.AcquireStart();

                // start the acquisition
                acquisitor.Configuration = currentProfile.AcquisitorConfig;
                WriteScanSettings(DataStore.TotalScan);
                acquisitor.AcquireStart(numberOfScans);
                appState = AppState.running;
            }
        }