예제 #1
0
        public CameraSettingsContainer AddNew(string description)
        {
            CameraSettingsContainer cs = new CameraSettingsContainer();

            cs.Description               = description;
            cs.ExposureLimit             = CurrentCameraSettings.ExposureLimit;
            cs.HighPixelThresholdPercent = CurrentCameraSettings.HighPixelThresholdPercent;
            cs.HSSIndex                           = CurrentCameraSettings.HSSIndex;
            cs.IncreasingSignal                   = CurrentCameraSettings.IncreasingSignal;
            cs.IsDefault                          = false;
            cs.LowPixelThresholdPercent           = CurrentCameraSettings.LowPixelThresholdPercent;
            cs.MaxPercentPixelsAboveHighThreshold = CurrentCameraSettings.MaxPercentPixelsAboveHighThreshold;
            cs.MinPercentPixelsAboveLowThreshold  = CurrentCameraSettings.MinPercentPixelsAboveLowThreshold;
            cs.StartingExposure                   = CurrentCameraSettings.StartingExposure;
            cs.UseEMAmp                           = CurrentCameraSettings.UseEMAmp;
            cs.UseFrameTransfer                   = CurrentCameraSettings.UseFrameTransfer;
            cs.VertClockAmpIndex                  = CurrentCameraSettings.VertClockAmpIndex;
            cs.VSSIndex                           = CurrentCameraSettings.VSSIndex;
            cs.EMGainLimit                        = CurrentCameraSettings.EMGainLimit;
            cs.StartingBinning                    = CurrentCameraSettings.StartingBinning;


            bool success = myWgDB.InsertCameraSettings(ref cs);

            if (success)
            {
                CameraSettingsList.Add(cs);
                CurrentCameraSettings = cs;
            }
            else
            {
                string errMsg = myWgDB.GetLastErrorMsg();
                MessageBox.Show("Failed to Add new Camera Settings record to database: " + errMsg, "Database Error", MessageBoxButton.OK, MessageBoxImage.Error);
                cs = null;
            }

            return(cs);
        }