private void Button_Click(object sender, RoutedEventArgs e) { if (win2 == null) { win2 = new Window2(); win2.Owner = this; win2.Show(); win2.Closing += OnCloseEvent; } }
private void Button_Click(object sender, RoutedEventArgs e) { if(win2 == null) { win2 = new Window2(); win2.Owner = this; win2.Show(); win2.Closing += OnCloseEvent; } }
private void OnCloseEvent(object sender, EventArgs args) { win2.Closing -= OnCloseEvent; win2 = null; }