コード例 #1
0
ファイル: Enums.cs プロジェクト: CHiiLD/net-toolkit
 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();
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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;
        }
コード例 #5
0
 public static MessageResults ShowDialog(
     String message, String title, MessageButtons button, MessageIcons icon)
 {
     return ShowDialog(message, title, button, icon, null, null);
 }
コード例 #6
0
 public static MessageResults ShowDialog(
     String message, String title, MessageButtons button, MessageIcons icon,
     SkinBundle bundle)
 {
     return(ShowDialog(message, title, button, icon, null, bundle));
 }
コード例 #7
0
ファイル: Message.cs プロジェクト: randomgeekdom/ForkTale
 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);
 }
コード例 #8
0
 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));
 }
コード例 #9
0
 public static String ShowDialog(String title, String msg, String text,
                                 MessageIcons icon, SkinBundle bundle)
 {
     return(ShowDialog(title, msg, text, icon, null, bundle, null));
 }
コード例 #10
0
 public static T ShowComboBoxChoiceDialog <T>(String title, String msg, MessageIcons icon, params T[] items)
 {
     return(ShowComboBoxChoiceDialog <T>(title, msg, icon, 0, null, items));
 }
コード例 #11
0
 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));
 }
コード例 #12
0
 public static String ShowComboBoxInputDialog(String title, String msg, MessageIcons icon, params String[] items)
 {
     return(ShowComboBoxInputDialog(title, msg, icon, -1, items));
 }
コード例 #13
0
 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));
 }
コード例 #14
0
 public MessagePageViewModel(string message, ViewModelBase doneTarget, MessageIcons messageIcon = MessageIcons.None)
 {
     this.Message      = message;
     this.DoneTarget   = doneTarget;
     this._messageIcon = messageIcon;
 }
コード例 #15
0
ファイル: Enums.cs プロジェクト: CHiiLD/net-toolkit
        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();
            }
        }