private void ConstructAllPixelsPlotVMs() { ObservableCollection <LJVScanVM> scanVMs = new ObservableCollection <LJVScanVM>(); ObservableCollection <ELSpecVM> ELSpecVMs = new ObservableCollection <ELSpecVM>(); ImageVMCollection = new ObservableCollection <ImageVM>(); foreach (Pixel p in TheDevice.Pixels) { if (SelectedTestCondition != null) { foreach (LJVScan scan in p.LJVScans) { if (scan.DeviceLJVScanSummary.TestCondition == SelectedTestCondition)//parse for LJVScans that correspond to selected value { scanVMs.Add(new LJVScanVM(scan)); } } foreach (ELSpectrum spec in p.ELSpectrums) { if (spec.DeviceLJVScanSummary != null && spec.DeviceLJVScanSummary.TestCondition == SelectedTestCondition) { ELSpecVMs.Add(new ELSpecVM(spec)); } } foreach (EFDeviceBatchCodeFirst.Image pic in p.Images) { if (pic.DeviceLJVScanSummary != null && pic.DeviceLJVScanSummary.TestCondition == SelectedTestCondition) { var thisVM = new ImageVM(pic); thisVM.Label = p.Site; ImageVMCollection.Add(thisVM); } } } } if (LJVPlotVM1 == null) { LJVPlotVM1 = new LJVPlotVM(scanVMs); TheELSpecPlotVM = new ELSpecPlotVM(ELSpecVMs); } else//do this instead of new PlotVMs to retain selected axes { LJVPlotVM1.SelectedViewStyle = LJVPlotVM.ViewStyle.Regular; TheELSpecPlotVM.SelectedViewStyle = ELSpecPlotVM.ViewStyle.Regular; LJVPlotVM1.LJVScanVMCollection = scanVMs; LJVPlotVM1.UpdatePlotModel(); TheELSpecPlotVM.ELSpecVMCollection = ELSpecVMs; TheELSpecPlotVM.UpdatePlotModel(); } Debug.WriteLine("constructed AllPixelsPlotVMs for: " + TheDevice.Label); }
private void ConstructPixelAgingPlotVMs() { var scanVMsList = new List <LJVScanVM>(); var ELSpecVMsList = new List <ELSpecVM>(); var imageVMList = new List <ImageVM>(); foreach (Pixel p in TheDevice.Pixels) { if (p.Site == SelectedPixel.Site) { foreach (LJVScan scan in p.LJVScans) { scanVMsList.Add(new LJVScanVM(scan)); } foreach (ELSpectrum spec in p.ELSpectrums) { ELSpecVMsList.Add(new ELSpecVM(spec)); } foreach (EFDeviceBatchCodeFirst.Image pic in p.Images) { var thisVM = new ImageVM(pic); thisVM.Label = pic.DeviceLJVScanSummary.TestCondition; imageVMList.Add(thisVM); } } } ObservableCollection <LJVScanVM> scanVMs = new ObservableCollection <LJVScanVM>(); if (scanVMsList.Count > 0) { scanVMs = new ObservableCollection <LJVScanVM>(scanVMsList.OrderBy(o => o.TheLJVScan.DeviceLJVScanSummary.TestCondition)); } ObservableCollection <ELSpecVM> ELSpecVMs = new ObservableCollection <ELSpecVM>(); if (ELSpecVMsList.Count > 0) { ELSpecVMs = new ObservableCollection <ELSpecVM>(ELSpecVMsList.OrderBy(o => o.TheELSpectrum.DeviceLJVScanSummary.TestCondition)); } if (imageVMList.Count > 0) { ImageVMCollection = new ObservableCollection <ImageVM>(imageVMList.OrderBy(o => o.TheImage.DeviceLJVScanSummary.TestCondition)); } if (LJVPlotVM1 == null) { LJVPlotVM1 = new LJVPlotVM(scanVMs); LJVPlotVM1.SelectedViewStyle = LJVPlotVM.ViewStyle.Aging; LJVPlotVM1.SelectedViewStyle = ELSpecPlotVM.ViewStyle.Aging; TheELSpecPlotVM = new ELSpecPlotVM(ELSpecVMs); } else { LJVPlotVM1.SelectedViewStyle = LJVPlotVM.ViewStyle.Aging; TheELSpecPlotVM.SelectedViewStyle = ELSpecPlotVM.ViewStyle.Aging; LJVPlotVM1.LJVScanVMCollection = scanVMs; LJVPlotVM1.UpdatePlotModel(); TheELSpecPlotVM.ELSpecVMCollection = ELSpecVMs; TheELSpecPlotVM.UpdatePlotModel(); } Debug.WriteLine("constructed PixelAgingPlotVMs for: " + TheDevice.Label); }