private static MessageResults ShowDialog( String message, String title, MessageButtons button, MessageIcons icon, ImageSource image, SkinBundle bundle) { MessageDialogEx dlg = new MessageDialogEx { Title = title, lblMessage = { Text = message }, icon = icon, imgIcon = { Source = MessageIconHelper.GetIcon(icon, bundle) } }; if (dlg.imgIcon.Source == null) { if (image != null) { dlg.imgIcon.Source = image; } } switch (button) { case MessageButtons.OK: dlg.btnOK.Visibility = Visibility.Visible; break; case MessageButtons.OKCancel: dlg.btnOK.Visibility = Visibility.Visible; dlg.btnCancel.Visibility = Visibility.Visible; break; case MessageButtons.YesNo: dlg.btnYes.Visibility = Visibility.Visible; dlg.btnNo.Visibility = Visibility.Visible; break; case MessageButtons.YesNoCancel: dlg.btnYes.Visibility = Visibility.Visible; dlg.btnNo.Visibility = Visibility.Visible; dlg.btnCancel.Visibility = Visibility.Visible; break; default: throw new NotImplementedException(); } if (bundle != null) { bundle.SetBundle(dlg); } dlg.ShowDialog(); return(dlg.Result); }
private static String ShowDialog(String title, String msg, String text, MessageIcons icon, ImageSource image, SkinBundle bundle, Func <String, bool> validateFunc) { InputDialogEx dlg = new InputDialogEx(); dlg.Title = title; dlg.txtInput.Text = text; if (validateFunc != null) { dlg.txtInput.TextChanged += (s, e) => { if (!validateFunc(dlg.txtInput.Text)) { dlg.txtInput.Undo(); } } } ; dlg.lblMessage.Text = msg; dlg.imgIcon.Source = MessageIconHelper.GetIcon(icon, bundle); if (dlg.imgIcon.Source == null) { if (image != null) { dlg.imgIcon.Source = image; } } if (bundle != null) { bundle.SetBundle(dlg); } /************************************************************/ if (dlg.ShowDialog().GetValueOrDefault(false)) { return(dlg.txtInput.Text); } else { return(null); } }
public static T ShowComboBoxChoiceDialog <T>(String title, String msg, MessageIcons icon, int index, SkinBundle bundle, params T[] items) { return(ShowComboBoxChoiceDialog <T>(title, msg, MessageIconHelper.GetIcon(icon, bundle), index, bundle, items)); }
public static String ShowComboBoxInputDialog(String title, String msg, MessageIcons icon, int index, SkinBundle bundle, params String[] items) { return(ShowComboBoxInputDialog(title, msg, MessageIconHelper.GetIcon(icon, bundle), index, bundle, items)); }