Beispiel #1
0
        void StartDeepUVFluorescence(int index)
        {
            indexUV = index;
            if (index == 0)
            {
                if (CheckSaveFileExists("_UV.bmp"))
                {
                    var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_UV.bmp");
                    saveDlg.ShowDialog();
                    if (!saveDlg.SaveFolderNameSet)
                    {
                        return;
                    }
                    _saveFolderName = saveDlg.SaveFolderName;
                    GlobalVariables.globalSettings.SaveFolderName = saveDlg.SaveFolderName;
                }
            }
            else if (index == 1)
            {
                if (CheckSaveFileExists("_UV2.bmp"))
                {
                    var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_UV2.bmp");
                    saveDlg.ShowDialog();
                    if (!saveDlg.SaveFolderNameSet)
                    {
                        return;
                    }
                    _saveFolderName = saveDlg.SaveFolderName;
                }
            }

            //var res = MessageBox.Show("Please confirm that the deep UV is on and then press OK to continue.", "Deep UV On",
            //    MessageBoxButton.OKCancel);

            //if (res == MessageBoxResult.Cancel)
            //    return;
            // TODO: arduino light on
            if (!Arduino.FluorescenceOn())
            {
                _cameraVM.AbortDeepUVFluorescence();

                MessageBox.Show("Serial Port Error... You may have to reset the camera.", "Aborting...");

                return;
            }

            Callback WhenMeasurementEnds = DeepUVFluorescenceCompleteCallback;

            _camPhosResults = new CamPhosResults(0, new List <PtGreyCameraImage>());
            string error = "";
            // TODO: settings for deep uv
            List <double> shutterTimes = Properties.Settings.Default.DeepUVFlMeasurementShutterTimes.Split(',').
                                         Select(r => Convert.ToDouble(r)).ToList();

            _camPhosActive = _cameraVM.StartDeepUVFluorescence(shutterTimes, Properties.Settings.Default.DeepUVFlMeasurementGain,
                                                               WhenMeasurementEnds, out error);

            if (!_camPhosActive)
            {
                MessageBox.Show(error, "Image Capture not started");
                return;
            }

            if (index == 0)
            {
                _measurementMode = MEASUREMENT_MODE.DP_FL;
            }
            else if (index == 1)
            {
                _measurementMode = MEASUREMENT_MODE.DP_FL2;
            }

            _statusVM.Busy++;
            DateTime timestamp = DateTime.Now;
            var      sts       = new StatusMessage {
                Timestamp = timestamp, Message = "Image capture is active."
            };

            _statusVM.Messages.Add(sts);
            _timestamps.Push(timestamp);
        }