private void Window_Closed(object sender, EventArgs e) { _isloaded = false; winMagnifier.Close(); winMagnifier = null; if (winSelectFace != null) { winSelectFace.Close(); winSelectFace = null; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (((MainWindow)this.Owner).DegPreRotate != 0) { chkRotate.IsChecked = true; } _isloaded = true; System.Diagnostics.Debug.Print("WinLoad"); Vector offset = VisualTreeHelper.GetOffset(((MainWindow)this.Owner).MainGrid); this.Top = ((MainWindow)this.Owner).Top + offset.Y + SystemParameters.WindowCaptionHeight; this.Left = ((MainWindow)this.Owner).Left + offset.X; _wbitmap = new WriteableBitmap(_mag_size, _mag_size, 96, 96, PixelFormats.Bgra32, null); winMagnifier = new Window3(); winMagnifier.Image1.Source = _wbitmap; UpdateMagnifier(0, 0); winMagnifier.Owner = this; winMagnifier.Show(); winMagnifier.Top = this.Top + Canvas.GetTop(Grid1) + SystemParameters.WindowCaptionHeight + 10; winMagnifier.Left = this.Left + Canvas.GetLeft(Grid1) + 10; if (winSelectFace != null) { winSelectFace.Close(); winSelectFace = null; } Button1_Click(null, null); Magnifier = winMagnifier; }