public static MessageBoxResult Show(string message, string title = null, Window owner = null, MessageBoxButton messageBoxButton = MessageBoxButton.OK, MessageBoxXConfigurations configurations = null) { if (configurations == null) configurations = new MessageBoxXConfigurations(); return CallMsgBox(owner, message, title, messageBoxButton, configurations); }
public static MessageBoxResult Show(string message, string title = null, Window owner = null, MessageBoxButton messageBoxButton = MessageBoxButton.OK, string configKey = null) { MessageBoxXConfigurations messageBoxXConfigurations = null; if (configKey.IsNullOrEmpty()) messageBoxXConfigurations = new MessageBoxXConfigurations(); else { if (!MessageBoxXConfigurations.ContainsKey(configKey)) throw new Exception($"Configuration key \"{configKey}\" does not exists."); messageBoxXConfigurations = MessageBoxXConfigurations[configKey]; } return CallMsgBox(owner, message, title, messageBoxButton, messageBoxXConfigurations); }
private static MessageBoxResult CallMsgBox(Window owner, string message, string title, MessageBoxButton messageBoxButton, MessageBoxXConfigurations configurations) { var msb = new MsgBox(owner, message, title, messageBoxButton, configurations); WindowX windowX = null; if (configurations.InteractOwnerMask && owner != null && owner is WindowX) { windowX = owner as WindowX; } if (windowX != null) { windowX.IsMaskVisible = true; } msb.ShowDialog(); if (windowX != null) { windowX.IsMaskVisible = false; } return(msb.MessageBoxResult); }
static MessageBoxX() { Configurations = new MessageBoxXConfigurations(); }