private void AddSops() { int total = 0; int failed = 0; //don't try to load something that's already there. if (IsStudyInStudyTree) { Platform.Log(LogLevel.Debug, "Study '{0} already exists in study tree.", StudyInstanceUid); return; } IsValidPrior = true; List<Sop> sops = _sops; _sops = null; foreach (Sop sop in sops) { try { _viewer.StudyTree.AddSop(sop); } catch (SopValidationException e) { ++failed; Platform.Log(LogLevel.Error, e); sop.Dispose(); } catch (Exception e) { ++failed; Platform.Log(LogLevel.Error, e); } ++total; } Study study = _viewer.StudyTree.GetStudy(StudyInstanceUid); LoadStudyException error = null; if (failed > 0 || study == null) error = new LoadStudyException(StudyInstanceUid, total, failed); if (study != null) { _viewer.EventBroker.OnStudyLoaded(new StudyLoadedEventArgs(study, error)); //We have to use the viewer's instance of the loader so that we don't end up with a prefetching //strategy per study loaded into the viewer. IPrefetchingStrategy prefetchingStrategy = _viewer.StudyLoaders[_studyLoaderName].PrefetchingStrategy; if (prefetchingStrategy != null) prefetchingStrategy.Start(_viewer); } if (error != null) throw error; }
private void AddSops() { int total = 0; int failed = 0; //don't try to load something that's already there. if (IsStudyInStudyTree) { Platform.Log(LogLevel.Debug, "Study '{0} already exists in study tree.", StudyInstanceUid); return; } IsValidPrior = true; List <Sop> sops = _sops; _sops = null; foreach (Sop sop in sops) { try { _viewer.StudyTree.AddSop(sop); } catch (SopValidationException e) { ++failed; Platform.Log(LogLevel.Error, e); sop.Dispose(); } catch (Exception e) { ++failed; Platform.Log(LogLevel.Error, e); } ++total; } Study study = _viewer.StudyTree.GetStudy(StudyInstanceUid); LoadStudyException error = null; if (failed > 0 || study == null) { error = new LoadStudyException(StudyInstanceUid, total, failed); } if (study != null) { _viewer.EventBroker.OnStudyLoaded(new StudyLoadedEventArgs(study, error)); //We have to use the viewer's instance of the loader so that we don't end up with a prefetching //strategy per study loaded into the viewer. //IPrefetchingStrategy prefetchingStrategy = _viewer.StudyLoaders[_studyLoaderName].PrefetchingStrategy; //if (prefetchingStrategy != null) // prefetchingStrategy.Start(_viewer); } if (error != null) { throw error; } }