public static bool ShowInformationYesNo(string caption, string header, string text, string details, Window wnd) { var dialog = new MdrMessageBox() { Owner = wnd, Caption = string.IsNullOrWhiteSpace(caption) ? "Message" : caption, InstructionHeading = string.IsNullOrWhiteSpace(header) ? "???" : header, InstructionText = string.IsNullOrWhiteSpace(text) ? String.Empty : text, DeatilsText = string.IsNullOrWhiteSpace(details) ? String.Empty : details }; dialog.SetButtonsPredefined(EnumPredefinedButtons.YesNo); dialog.DetailsExpander.Visibility = string.IsNullOrEmpty(details) ? Visibility.Collapsed : Visibility.Visible; return((bool)dialog.ShowDialog()); }
public static void ShowError(string errStr, Window wnd) { string caption = errStr[0] == Constants.HeavyExclamation ? "WARNIG" : (errStr[0] == Constants.HeavyExclamation ? "INFORMATION" : "ERROR"); string[] parts = errStr.Split(new[] { Constants.HeavyGreekCrossPadded }, StringSplitOptions.None); MdrMessageBox dialog; if (parts.Length > 2) { dialog = new MdrMessageBox() { Owner = wnd, Caption = parts[0], InstructionHeading = parts[1], InstructionText = parts[2], DeatilsText = parts.Length > 3 ? parts[3] : string.Empty }; } else if (parts.Length > 1) { dialog = new MdrMessageBox() { Owner = wnd, Caption = caption, InstructionHeading = parts[0], InstructionText = parts[1], DeatilsText = string.Empty }; } else { dialog = new MdrMessageBox() { Owner = wnd, Caption = caption, InstructionHeading = string.Empty, InstructionText = errStr, DeatilsText = string.Empty }; } dialog.SetButtonsPredefined(EnumPredefinedButtons.Ok); dialog.DetailsExpander.Visibility = string.IsNullOrWhiteSpace(dialog.DeatilsText) ? Visibility.Collapsed : Visibility.Visible; dialog.ShowDialog(); }