ShowMessageBoxHelper( System.Windows.Window parent, string text, string title, System.Windows.MessageBoxButton buttons, System.Windows.MessageBoxImage image ) { (new SecurityPermission(SecurityPermissionFlag.UnmanagedCode)).Assert(); try { // if we have a known parent window set, let's use it when alerting the user. if (parent != null) { System.Windows.MessageBox.Show(parent, text, title, buttons, image); } else { System.Windows.MessageBox.Show(text, title, buttons, image); } } finally { SecurityPermission.RevertAssert(); } }
ShowMessageBoxHelper( IntPtr parentHwnd, string text, string title, System.Windows.MessageBoxButton buttons, System.Windows.MessageBoxImage image ) { // NOTE: the last param must always be MessageBoxOptions.None for this to be considered TreatAsSafe System.Windows.MessageBox.ShowCore(parentHwnd, text, title, buttons, image, MessageBoxResult.None, MessageBoxOptions.None); }
protected DialogBase( IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher, System.Windows.MessageBoxImage image = MessageBoxImage.None) { this.dialogHost = dialogHost; this.dispatcher = dispatcher; this.Mode = dialogMode; this.Image = image; this.CloseBehavior = DialogCloseBehavior.AutoCloseOnButtonClick; this.OkText = Strings.OK_Button_Label; this.CancelText = Strings.Cancel_Button_Label; this.YesText = Strings.Yes_Button_Label; this.NoText = Strings.No_Button_Label; switch (dialogMode) { case DialogMode.None: break; case DialogMode.Ok: this.CanOk = true; break; case DialogMode.Cancel: this.CanCancel = true; break; case DialogMode.OkCancel: this.CanOk = true; this.CanCancel = true; break; case DialogMode.YesNo: this.CanYes = true; this.CanNo = true; break; case DialogMode.YesNoCancel: this.CanYes = true; this.CanNo = true; this.CanCancel = true; break; default: throw new ArgumentOutOfRangeException(nameof(dialogMode)); } }
private WaitProgressDialog( IDialogHost dialogHost, DialogMode dialogMode, bool isIndeterminate, Dispatcher dispatcher, System.Windows.MessageBoxImage image = MessageBoxImage.None) : base(dialogHost, dialogMode, dispatcher, image) { this.HorizontalDialogAlignment = HorizontalAlignment.Center; this.VerticalDialogAlignment = VerticalAlignment.Center; this.waitProgressDialogControl = new WaitProgressDialogControl(isIndeterminate); this.SetContent(this.waitProgressDialogControl); }
ShowMessageBoxHelper( System.Windows.Window parent, string text, string title, System.Windows.MessageBoxButton buttons, System.Windows.MessageBoxImage image ) { // if we have a known parent window set, let's use it when alerting the user. if (parent != null) { System.Windows.MessageBox.Show(parent, text, title, buttons, image); } else { System.Windows.MessageBox.Show(text, title, buttons, image); } }
ShowMessageBoxHelper( IntPtr parentHwnd, string text, string title, System.Windows.MessageBoxButton buttons, System.Windows.MessageBoxImage image ) { (new SecurityPermission(SecurityPermissionFlag.UnmanagedCode)).Assert(); try { // NOTE: the last param must always be MessageBoxOptions.None for this to be considered TreatAsSafe System.Windows.MessageBox.ShowCore(parentHwnd, text, title, buttons, image, MessageBoxResult.None, MessageBoxOptions.None); } finally { SecurityPermission.RevertAssert(); } }
public MessageDialog( IDialogHost dialogHost, DialogMode dialogMode, string message, Dispatcher dispatcher, System.Windows.MessageBoxImage image = MessageBoxImage.None) : base(dialogHost, dialogMode, dispatcher, image) { this.HorizontalDialogAlignment = HorizontalAlignment.Center; this.VerticalDialogAlignment = VerticalAlignment.Center; this.InvokeUICall(() => { this.messageTextBlock = new TextBlock { Text = message, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, }; this.SetContent(this.messageTextBlock); }); }
public System.Windows.MessageBoxResult ShowMessage(string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon) { return(MessageBoxResult.None); }
public static Result DisplayMessage(string title = null, string message = "", Button button = Button.OK, Icon icon = Icon.None) => MessageBox.Show(message, title, button, icon);
public Result ShowMessage(string message, string title = null, Button button = Button.OK, Icon icon = Icon.None) => MessageBox.Show(message, title ?? Vsix.Name, button, icon);
//Diese Funtion dient zum Testen der Felden unserer verschiedenen Formulare // Die liefert den Wert 1, falls alles gut passiert ist. Wenn icht, dann wird der Wert 0 ausgeliefert. public int testFormular(List <string> elementeListe) { //Man nimmt an, alles ist nicht ok am Anfang int testResult = 1; string error; Dictionary <string, string> dict = new Dictionary <string, string>(); foreach (string element in elementeListe) { switch (element) { case "txtBox_titel": if (txtBox_titel.Text == "") { error = "Der Titel muss eingegeben werden!"; dict.Add("txtBox_titel", error); } break; case "txtBox_stunden": if (txtBox_stunden.Text.Trim() == "") { error = "Das Feld für Stunden muss mit einer Zahl zwischen 0 und 23 ausgefüllt werden!"; dict.Add("txtBox_stunden", error); } else // Das Feld ist nicht leer { int stunden; // Check if the point entered is numeric or not if (Int32.TryParse(txtBox_stunden.Text, out stunden)) { //Eine Zahl wurde eingegeben... if (0 <= stunden && stunden <= 23) { // System.Windows.MessageBox.Show("" + stunden); } else { error = "Das Feld für Stunden muss mit einer Zahl zwischen 0 und 23 ausgefüllt werden!"; dict.Add("txtBox_stunden", error); } // Do what you want to do if numeric //System.Windows.MessageBox.Show(""+stunden); } else { // Do what you want to do if not numeric //System.Windows.Forms.MessageBox.Show("non numeric"); error = "Das Feld für Stunden muss mit einer Zahl zwischen 0 und 23 ausgefüllt werden!"; dict.Add("txtBox_stunden", error); } } break; case "txtBox_minuten": if (txtBox_minuten.Text == "") { error = "Das Feld für Minuten muss mit einer Zahl zwischen 0 und 59 ausgefüllt werden!"; dict.Add("txtBox_minuten", error); } else { int minuten; // Check if the point entered is numeric or not if (Int32.TryParse(txtBox_minuten.Text, out minuten)) { // Do what you want to do if numeric if (0 <= minuten && minuten <= 59) { //System.Windows.MessageBox.Show("" + minuten); } else { error = "Das Feld für Minuten muss mit einer Zahl zwischen 0 und 59 ausgefüllt werden!"; dict.Add("txtBox_minuten", error); } } else { // Do what you want to do if not numeric // System.Windows.Forms.MessageBox.Show("non numeric"); error = "Das Feld für Minuten muss mit einer Zahl zwischen 0 und 23 ausgefüllt werden!"; dict.Add("txtBox_minuten", error); } } break; } } int anzahlDerElemente = dict.Count; if (anzahlDerElemente > 0) { //Es heißt, es gibt ein Problem irgendwo testResult = 0; List <string> tmpl = new List <string>(); foreach (KeyValuePair <string, string> item in dict) { // Console.WriteLine("Key: {0}, Value: {1}", item.Key, item.Value); tmpl.Add(item.Value); Console.WriteLine("Erreur au niveau de: " + item.Key + " contenu erreur: " + item.Value); } //Der Rückgabewert(eine Zeichenkette) wird erzeugt. string total = ""; for (int i = 0; i < tmpl.Count; i++) { total = total + tmpl[i] + "\n \n"; } // MessageBox.Show(total); // Configure message box string caption = "Falsche oder Fehlende Angaben"; System.Windows.MessageBoxButton buttons = MessageBoxButton.OK; System.Windows.MessageBoxImage icon = System.Windows.MessageBoxImage.Exclamation; // Show message box System.Windows.MessageBoxResult result = System.Windows.MessageBox.Show(total, caption, buttons, icon); //MessageBox.Show("Some text", "Some title", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(testResult); }
internal static Exception Display(this Exception ex, string msg = null, System.Windows.MessageBoxImage icon = System.Windows.MessageBoxImage.Error) { MessageBox.Show(msg ?? ex.Message, "", System.Windows.MessageBoxButton.OK, icon); return(ex); }
public IMessageDialog CreateMessageDialog(string message, string caption, DialogMode dialogMode, System.Windows.MessageBoxImage image = MessageBoxImage.None) { IMessageDialog dialog = null; this.InvokeInUIThread(() => { dialog = new MessageDialog(this.dialogHost, dialogMode, message, this.dispatcher, image) { Caption = caption, }; }); return(dialog); }