コード例 #1
0
 public void Spectrums_SelectionChanged(SelectionChangedEventArgs args)
 {
     SelectedSpectrums.AddRange(args.AddedItems.Cast <object>().Where(x => x is SpectrumBase).Cast <SpectrumBase>());
     args.RemovedItems.Cast <object>().Where(x => x is SpectrumBase).Cast <SpectrumBase>().ToList().ForEach(x => SelectedSpectrums.Remove(x));
     NotifyOfPropertyChange(() => CanDeleteSpectrums);
     NotifyOfPropertyChange(() => CanImportToWorkspace);
 }
コード例 #2
0
 public void DeleteSpectrums()
 {
     // .ToList() conversion is important here, as the code itself will modify
     // the elements of the original collection (ToList() instatinates a copy of the collection)
     foreach (var selectedSpectrum in SelectedSpectrums.ToList())
     {
         Database.GetConnection().Delete(selectedSpectrum);
         SelectedSpectrums.Remove(selectedSpectrum);
         PreparedForImport.Remove(selectedSpectrum);
         Spectrums.Remove(selectedSpectrum);
     }
 }
コード例 #3
0
 public void ImportToWorkspace()
 {
     PreparedForImport.AddRange(SelectedSpectrums);
     SelectedSpectrums.Clear();
     NotifyOfPropertyChange(() => CanImportToWorkspace);
 }