public void SetParameters(MassSpecStudio.Core.Domain.Algorithm algorithm) { if (algorithm != null) { foreach (MassSpecStudio.Core.Domain.ProcessingStep processingParameters in algorithm.ProcessingSteps) { IProcessingStep processingStep = _processingSteps.Where(item => item.GetType().FullName == processingParameters.Type).FirstOrDefault(); if (processingStep != null) { foreach (ProcessingParameter processingParameter in processingParameters.Parameters) { PropertyInfo propertyInfo = processingStep.GetType().GetProperty(processingParameter.Name); if (propertyInfo.PropertyType.IsEnum) { object enumValue = Enum.Parse(propertyInfo.PropertyType, processingParameter.Value); propertyInfo.SetValue(processingStep, enumValue, null); } else { propertyInfo.SetValue(processingStep, Convert.ChangeType(processingParameter.Value, propertyInfo.PropertyType), null); } } } } } }
public static void Write(MassSpecStudio.Core.Domain.Algorithm algorithm) { IList<MassSpecStudio.Core.Domain.Algorithm> allAlgorithms = Read(); IList<MassSpecStudio.Core.Domain.Algorithm> algorithms = allAlgorithms.Where(item => item.Name == algorithm.Name).ToList(); while (algorithms.Count >= NumberOfAlgorithmsInRecentHistory) { MassSpecStudio.Core.Domain.Algorithm oldestAlgorithm = algorithms.First(); algorithms.Remove(oldestAlgorithm); allAlgorithms.Remove(oldestAlgorithm); } allAlgorithms.Add(algorithm); Properties.Settings.Default.RecentAlgorithms = ConvertListToString(allAlgorithms); Properties.Settings.Default.Save(); }
private void OnLoadParameters(MassSpecStudio.Core.Domain.Algorithm algorithm) { SelectedAlgorithm.SetParameters(algorithm); }
private ExperimentBase OpenExperiment(MassSpecStudio.Core.Domain.ProjectBase.ExperimentReference experimentFile, ProjectBase project) { IExperimentType experimentType = _experimentTypes.Where(data => data.ExperimentType == experimentFile.ExperimentType).First(); ExperimentBase experiment = experimentType.Open(Path.Combine(project.Directory, experimentFile.Location), project); experiment.ExperimentTypeObject = experimentType; return experiment; }
public IXYData GetExtractedIonChromatogram(double mass1, double mass2, double mzWindow, MassSpecStudio.Core.TimeUnit timeUnits) { return _dataProvider.GetExtractedIonChromatogram(mass1, mass2, mzWindow, timeUnits); }