internal AltMessageBox(AltMessageBoxArgs param) { InitializeComponent(); Message = param.title; Caption = param.caption; if (param.icon == MessageBoxImage.None) { Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed; } else { DisplayImage(param.icon); } DisplayButtons(param.button); }
/// <summary> /// Displays a message box flexible to your liking. /// </summary> /// <param name="param">Defines what the messagebox does</param> /// <returns>A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user.</returns> public static AltMessageBoxResult Show(AltMessageBoxArgs param) { AltMessageBox msg = new AltMessageBox(param); if (param.OKText != string.Empty) { msg.OkButtonText = param.OKText; } if (param.YesText != string.Empty) { msg.YesButtonText = param.YesText; } if (param.NoText != string.Empty) { msg.NoButtonText = param.NoText; } if (param.CancelText != string.Empty) { msg.CancelButtonText = param.CancelText; } if (param.RetryText != string.Empty) { msg.RetryButtonText = param.RetryText; } if (param.AbortText != string.Empty) { msg.AbortButtonText = param.AbortText; } if (param.YesToAllText != string.Empty) { msg.YesToAllButtonText = param.YesToAllText; } if (param.NoToAllText != string.Empty) { msg.NoToAllButtonText = param.NoToAllText; } msg.ShowDialog(); return(msg.Result); }