private void btnPop_Click(object sender, RoutedEventArgs e) { if (popWindow == null) { popWindow = new PopWindow(); popWindow.Closed -= PopWindow_Closed; popWindow.Closed += PopWindow_Closed; popWindow.Owner = Application.Current.MainWindow; popWindow.ShowDialog(); } else if (!popWindow.IsActive) { popWindow.WindowState = WindowState.Normal; popWindow.Activate(); } }
private void PopWindow_Closed(object sender, EventArgs e) { popWindow = null; }