private void OnWindowClosing(object sender, CancelEventArgs e) { if (m_ButtonTriggersClose) { ContentPlaceHolder.Content = null; DetailsPlaceHolder.Content = null; if (m_whenDoneAction != null) { m_whenDoneAction.Invoke(); m_whenDoneAction = null; } return; } if (!AllowEscapeAndCloseButton) { AudioCues.PlayAsterisk(); e.Cancel = true; return; } ContentPlaceHolder.Content = null; DetailsPlaceHolder.Content = null; if (m_whenDoneAction != null) { m_whenDoneAction.Invoke(); m_whenDoneAction = null; } }
protected override void OnKeyUp(KeyEventArgs e) { if (!IgnoreEscape && e.Key == Key.Escape) { if (AllowEscapeAndCloseButton) { m_ButtonTriggersClose = false; Close(); } else { AudioCues.PlayAsterisk(); } } base.OnKeyUp(e); }