private void DialogNotBlocksButton_Click(object sender, RoutedEventArgs e) { IsDialogReturnedButton.Text = "The dialog has not returned"; TestSubWindow testSubWindow = new TestSubWindow(); testSubWindow.Owner = GetWindow(this); testSubWindow.Visibility = Visibility.Hidden; testSubWindow.Hide(); testSubWindow.ShowDialog(); IsDialogReturnedButton.Text = "The dialog has returned"; testSubWindow.WindowState = WindowState.Normal; testSubWindow.Show(); }
private void MemoryLeakTestingButton_Click(object sender, RoutedEventArgs e) { //GC.Collect(); //GC.WaitForPendingFinalizers(); //GC.Collect(); window = new TestSubWindow(); window.ShowDialog(); //don't need to call Close() to free up memory. It won't. // only setting it to null will allow it to be collected //window.Close(); window = null; //GC.Collect(); //GC.WaitForPendingFinalizers(); //GC.Collect(); //in this current configuration, the TestSubWindow does *not* show up in the memory profiler }