public static ImageSource GetIcon(MessageIcons icon, SkinBundle bundle) { switch (icon) { case MessageIcons.None: return null; case MessageIcons.Info: if ((bundle != null) && (bundle.InfoIcon != null)) return bundle.InfoIcon; else return ResourceManager.IMAGE_INFO; case MessageIcons.Error: if ((bundle != null) && (bundle.ErrorIcon != null)) return bundle.ErrorIcon; else return ResourceManager.IMAGE_ERROR; case MessageIcons.Warn: if ((bundle != null) && (bundle.WarnIcon != null)) return bundle.WarnIcon; else return ResourceManager.IMAGE_WARN; case MessageIcons.Qestion: if ((bundle != null) && (bundle.QuestionIcon != null)) return bundle.QuestionIcon; else return ResourceManager.IMAGE_QUESTION; case MessageIcons.OK: if ((bundle != null) && (bundle.OKIcon != null)) return bundle.OKIcon; else return ResourceManager.IMAGE_OK; default: throw new NotImplementedException(); } }
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); } }
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; }
public static MessageResults ShowDialog( String message, String title, MessageButtons button, MessageIcons icon) { return ShowDialog(message, title, button, icon, null, null); }
public static MessageResults ShowDialog( String message, String title, MessageButtons button, MessageIcons icon, SkinBundle bundle) { return(ShowDialog(message, title, button, icon, null, bundle)); }
public static MessageResult ShowMessage(string text, string caption, MessageButtons buttons = MessageButtons.OK, MessageIcons icon = MessageIcons.Information) { return (MessageResult) MessageBox.Show(text, caption, (MessageBoxButtons) buttons, (MessageBoxIcon) icon); }
public static String ShowDialog(String title, String msg, String text, MessageIcons icon, Func <String, bool> validateFunc) { return(ShowDialog(title, msg, text, icon, null, null, validateFunc)); }
public static String ShowDialog(String title, String msg, String text, MessageIcons icon, SkinBundle bundle) { return(ShowDialog(title, msg, text, icon, null, bundle, null)); }
public static T ShowComboBoxChoiceDialog <T>(String title, String msg, MessageIcons icon, params T[] items) { return(ShowComboBoxChoiceDialog <T>(title, msg, icon, 0, null, items)); }
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, params String[] items) { return(ShowComboBoxInputDialog(title, msg, icon, -1, 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)); }
public MessagePageViewModel(string message, ViewModelBase doneTarget, MessageIcons messageIcon = MessageIcons.None) { this.Message = message; this.DoneTarget = doneTarget; this._messageIcon = messageIcon; }
public static ImageSource GetIcon(MessageIcons icon, SkinBundle bundle) { switch (icon) { case MessageIcons.None: return(null); case MessageIcons.Info: if ((bundle != null) && (bundle.InfoIcon != null)) { return(bundle.InfoIcon); } else { return(ResourceManager.IMAGE_INFO); } case MessageIcons.Error: if ((bundle != null) && (bundle.ErrorIcon != null)) { return(bundle.ErrorIcon); } else { return(ResourceManager.IMAGE_ERROR); } case MessageIcons.Warn: if ((bundle != null) && (bundle.WarnIcon != null)) { return(bundle.WarnIcon); } else { return(ResourceManager.IMAGE_WARN); } case MessageIcons.Qestion: if ((bundle != null) && (bundle.QuestionIcon != null)) { return(bundle.QuestionIcon); } else { return(ResourceManager.IMAGE_QUESTION); } case MessageIcons.OK: if ((bundle != null) && (bundle.OKIcon != null)) { return(bundle.OKIcon); } else { return(ResourceManager.IMAGE_OK); } default: throw new NotImplementedException(); } }