/// <summary> /// Shows or hides instrument Precursor m/z and mass from the instrument /// Reads data from LCMSRun if necessary /// </summary> /// <param name="value">Should the instrument data be shown?</param> /// <param name="pbfLcmsRun">LCMSRun for this data set.</param> /// <returns>Asynchronous task.</returns> public async Task ToggleShowInstrumentDataAsync(bool value, PbfLcMsRun pbfLcmsRun) { if (value) { if (pbfLcmsRun != null) { var scans = this.Data; foreach (var scan in scans.Where(scan => scan.Sequence.Count == 0)) { PrSm scan1 = scan; IsolationWindow isolationWindow = await Task.Run(() => pbfLcmsRun.GetIsolationWindow(scan1.Scan)); scan.PrecursorMz = isolationWindow.MonoisotopicMz ?? double.NaN; scan.Charge = isolationWindow.Charge ?? 0; scan.Mass = isolationWindow.MonoisotopicMass ?? double.NaN; } } } else { var scans = this.Data; foreach (var scan in scans.Where(scan => scan.Sequence.Count == 0)) { scan.PrecursorMz = double.NaN; scan.Charge = 0; scan.Mass = double.NaN; } } }