Beispiel #1
0
        ///////////////////////////////////////////////////////////////////////
        // When a setting in the filter list changes this will get called by
        // the application.
        ///////////////////////////////////////////////////////////////////////
        void Experiment_SettingChanged(object sender, SettingChangedEventArgs e)
        {
            // Setting name
            string settingName = ":  Setting:" + e.Setting;

            // Setting value
            string settingValue = " Value: " + theExperiment_.GetValue(e.Setting).ToString();

            // Time Stamp
            DateTimeOffset dateTimeOffset = DateTimeOffset.Now;

            // Stream Writer Set to append if the file is there
            using (StreamWriter fs = new StreamWriter(fullName_, true))
            {
                if (fs != null)
                {
                    fs.WriteLine(dateTimeOffset.ToString() + settingName + settingValue);
                }
            }
        }
        ///////////////////////////////////////////////////////////////////////
        // The first index of the filemanager's GetRecentlyAcquireFileNames is
        // always the last file acquired..
        ///////////////////////////////////////////////////////////////////////
        void ShowImageDataFromLastAcquire()
        {
            // Expected resulting file name
            string resultName
                = (string)experiment_.GetValue(ExperimentSettings.AcquisitionOutputFilesResult);

            // Open the last acquired file
            IList <string> files
                = fileManager_.GetRecentlyAcquiredFileNames();

            // Is our result in the acquired
            if (files.Contains(resultName))
            {
                //  Open file
                IImageDataSet dataSet
                    = fileManager_.OpenFile(resultName, FileAccess.Read);

                // Stop processing if we do not have all frames
                if (dataSet.Frames != frames_)
                {
                    // Close the file
                    fileManager_.CloseFile(dataSet);

                    throw new ArgumentException("Frames are not equal");
                }

                //  Cache image data
                Array imageData
                    = dataSet.GetFrame(0, frames_ - 1).GetData();

                //  Cache the frame
                IImageData imageFrame
                    = dataSet.GetFrame(0, frames_ - 1);

                //  Print some of the cached data
                PrintData(imageData, imageFrame);

                // Close the file
                fileManager_.CloseFile(dataSet);
            }
        }