public void OnWindowClosing(object sender, CancelEventArgs e) { if (Blocker.IsBlocked() || !closingAllowed) { e.Cancel = true; } }