public ExposureCalculatorVM(IProfileService profileService, IImagingMediator imagingMediator, ISharpCapSensorAnalysisReader sharpCapSensorAnalysisReader) : base(profileService) { this._imagingMediator = imagingMediator; this.Title = "LblExposureCalculator"; this._sharpCapSensorAnalysisReader = sharpCapSensorAnalysisReader; if (Application.Current != null) { ImageGeometry = (System.Windows.Media.GeometryGroup)Application.Current.Resources["CalculatorSVG"]; } DetermineExposureTimeCommand = new AsyncCommand <bool>(DetermineExposureTime); CancelDetermineExposureTimeCommand = new RelayCommand(TriggerCancelToken); DetermineBiasCommand = new AsyncCommand <bool>(DetermineBias); ReloadSensorAnalysisCommand = new AsyncCommand <bool>(ReloadSensorAnalysis); CancelDetermineBiasCommand = new RelayCommand(TriggerCancelToken); this._sharpCapSensorAnalysisDisabledValue = "(" + Locale.Loc.Instance["LblDisabled"] + ")"; this._sharpCapSensorNames = new ObservableCollection <string>(); var configuredPath = this.profileService.ActiveProfile.ImageSettings.SharpCapSensorAnalysisFolder; if (String.IsNullOrEmpty(configuredPath)) { // Attempt load for default configuration only if the directory exists to avoid log spam if (Directory.Exists(SharpCapSensorAnalysisConstants.DEFAULT_SHARPCAP_SENSOR_ANALYSIS_PATH)) { LoadSensorAnalysisData(SharpCapSensorAnalysisConstants.DEFAULT_SHARPCAP_SENSOR_ANALYSIS_PATH); } } else { LoadSensorAnalysisData(configuredPath); } }
public void TestSetup() { this.sensorAnalysisTestDataPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"ImageAnalysis\TestData"); this.reader = new DefaultSharpCapSensorAnalysisReader(); }
private static ImmutableDictionary <string, SharpCapSensorAnalysisData> ReadSensorAnalysisData(ISharpCapSensorAnalysisReader sharpCapSensorAnalysisReader, string path) { try { return(sharpCapSensorAnalysisReader.Read(path)); } catch (Exception ex) { Logger.Error(ex, "Failed to read SharpCap sensor analysis data"); return(ImmutableDictionary.Create <string, SharpCapSensorAnalysisData>()); } }