/// <summary> /// Only way to clear the memory used /// </summary> public void Dispose() { try { this.LayoutManager.RemoveView2dWindow(this); Viewer2d Viewer2DWindow = (this.Content as Viewer2d); Viewer2dViewModel Viewer2ViewModel = (Viewer2DWindow.DataContext as Viewer2dViewModel); Viewer2ViewModel.cleanup(); GC.SuppressFinalize(Viewer2ViewModel); GC.SuppressFinalize(this); this.DataContext = null; GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { string dicomFilesPath = txtDicomFilesPath.Text; var MainViewerWindow = new ViewerWindow(); var Viewer2DWindow = new Viewer2d(); var Viewer2ViewModel = new Viewer2dViewModel(); Viewer2DWindow.DataContext = Viewer2ViewModel; MainViewerWindow.Content = Viewer2DWindow; MainViewerWindow.Show(); //load dicom files Viewer2ViewModel.LoadDicomFilesFromPath(dicomFilesPath); }
private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var MainViewerWindow = new ViewerWindow(); var Viewer2DWindow = new Viewer2d(); var Viewer2ViewModel = new Viewer2dViewModel(); Viewer2DWindow.DataContext = Viewer2ViewModel; //add to layouts //layoutManager.Viewer2dWindowsList.Add(MainViewerWindow); //layoutManager.SetPositionForNewViewer(MainViewerWindow); layoutManager.AddNewViewerWindow(MainViewerWindow); MainViewerWindow.Content = Viewer2DWindow; MainViewerWindow.Show(); var dicomSeries = ((sender as ListBox).SelectedItem as DicomSeries); //load dicom files //Viewer2ViewModel.LoadDicomFilesFromStudy(dicomSeries); Viewer2ViewModel.LoadBitmapsFromStudy(dicomSeries); }