public static void PlainExecuted(Window parent, ExecutedRoutedEventArgs e) { if (thresholdWindow == null) { thresholdWindow = new ThresholdWindow(parent); thresholdWindow.OnClosedOnce = () => thresholdWindow = null; } thresholdWindow.Show(); thresholdWindow.Activate(); e.Handled = true; }