private void NavigationWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (CustomMsgBox.Show(Window.GetWindow(this), "ソフトを終了してよろしいですか?", "九九ソフト", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No) { e.Cancel = true; } }
/// <summary> /// メッセージボックスを表示する /// </summary> /// <param name="owner"></param> /// <param name="messageBoxText"></param> /// <param name="caption"></param> /// <param name="button"></param> /// <param name="icon"></param> /// <returns></returns> public static MessageBoxResult Show( Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon) { if (owner.WindowState == WindowState.Minimized) { return(MessageBox.Show(owner, messageBoxText, caption, button, icon)); } else { CustomMsgBox mbox = new CustomMsgBox(owner); return(mbox.Show(messageBoxText, caption, button, icon)); } }