public static MessageBoxResult Show(Window owner, string msg, string title = "", MessageBoxButton buttons = MessageBoxButton.OK, MessageBoxImage image = MessageBoxImage.None)
        {
            var dialog = new MessageBoxWindow();

            dialog.MyTitle             = title;
            dialog.Message             = msg;
            dialog.imInfo.Visibility   = image == MessageBoxImage.Information ? Visibility.Visible : Visibility.Collapsed;
            dialog.imAlert.Visibility  = image == MessageBoxImage.Warning ? Visibility.Visible : Visibility.Collapsed;
            dialog.imHelp.Visibility   = image == MessageBoxImage.Question ? Visibility.Visible : Visibility.Collapsed;
            dialog.btOK.Visibility     = buttons == MessageBoxButton.OK || buttons == MessageBoxButton.OKCancel? Visibility.Visible : Visibility.Collapsed;
            dialog.btCancel.Visibility = buttons == MessageBoxButton.OKCancel || buttons == MessageBoxButton.YesNoCancel ? Visibility.Visible : Visibility.Collapsed;
            dialog.btYes.Visibility    = buttons == MessageBoxButton.YesNo || buttons == MessageBoxButton.YesNoCancel ? Visibility.Visible : Visibility.Collapsed;
            dialog.btNo.Visibility     = dialog.btYes.Visibility;
            dialog.Owner = owner;
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            dialog.ShowDialog();
            dialog.Close();
            return(dialog.MyResult);
        }
Esempio n. 2
0
 public void ShowMessage(string msg)
 {
     //MainWindow.ShowMessage(msg);
     //MessageBox.Show(msg);
     MessageBoxWindow.Show(MainWindow, msg, "Zolīte", MessageBoxButton.OK, MessageBoxImage.Warning);
 }