예제 #1
0
        public static LoginData ShowDialog(String title, String header, String info,
            String userNameText, String userName, ImageSource icon, SkinBundle bundle, Func<String, String, bool> validateUser)
        {
            LoginDialogEx dlg = new LoginDialogEx(validateUser, bundle)
                {
                    Title = title,
                    hInfo =
                        {
                            HeaderContent = header,
                            DescriptionText = info
                        }
                };
            if (bundle != null)
            {
                bundle.SetBundle(dlg);
            }

            if (userNameText != null)
                dlg.lblUserName.Content = userNameText;
            dlg.txtUsername.Text = userName;
            if (icon != null)
                dlg.Icon = icon;

            if (dlg.ShowDialog().GetValueOrDefault(false))
                return new LoginData(dlg.txtUsername.Text, dlg.txtPassword.Password);
            else
                return null;
        }
예제 #2
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();
     }
 }
        private PasswordChangeDialogEx(Func<String, bool> validatePassword, SkinBundle bundle)
        {
            InitializeComponent();

            this.validatePassword = validatePassword;
            this.bundle = bundle;
        }
예제 #4
0
        public static void ShowDialog(String title, String msg, Exception e, SkinBundle bundle)
        {
            ErrorDialogEx dlg = new ErrorDialogEx();

            if (bundle != null)
                bundle.SetBundle(dlg);

            dlg.Title = title;
            dlg.lblError.Text = e.GetType().Name + ": " + e.Message + "\n" + e.StackTrace;
            dlg.lblMsg.Text = msg;

            dlg.ShowDialog();
        }
예제 #5
0
 private void lstSkins_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lstSkins.SelectedIndex < 0)
         activeBundle = null;
     else
     {
         switch ((lstSkins.SelectedItem as ListBoxItem).Content.ToString().ToLower())
         {
             case "default":
                 activeBundle = null;
                 break;
             case "nimbus":
                 activeBundle = NimbusSkin.SkinBundle;
                 break;
             case "paper":
                 activeBundle = PaperSkin.SkinBundle;
                 break;
             case "sims 3":
                 activeBundle = Sims3Skin.SkinBundle;
                 break;
             case "chalk":
                 activeBundle = ChalkSkin.SkinBundle;
                 break;
             case "art":
                 activeBundle = ArtSkin.SkinBundle;
                 break;
             case "portal":
                 activeBundle = PortalSkin.SkinBundle;
                 break;
             case "cim":
                 activeBundle = CIMSkin.SkinBundle;
                 break;
             default:
                 throw new NotImplementedException();
         }
     }
 }
        public static String ShowDialog(String title, String header, String info, ImageSource icon,
            SkinBundle bundle, Func<String, bool> validatePassword)
        {
            PasswordChangeDialogEx dlg = new PasswordChangeDialogEx(validatePassword, bundle)
                {
                    Title = title,
                    hInfo =
                        {
                            HeaderContent = header,
                            DescriptionText = info
                        }
                };
            if (icon != null)
                dlg.hInfo.IconSource = icon;
            if (bundle != null)
            {
                bundle.SetBundle(dlg);
            }

            if (dlg.ShowDialog().GetValueOrDefault(false))
                return dlg.txtNewPassword.Password;
            else
                return null;
        }
예제 #7
0
 private LoginDialogEx(Func<String, String, bool> validate, SkinBundle bundle)
 {
     InitializeComponent();
     this.validate = validate;
     this.bundle = bundle;
 }
예제 #8
0
 public static LoginData ShowDialog(String title, String header, String info,
     String userName, ImageSource icon, SkinBundle bundle, Func<String, String, bool> validateUser)
 {
     return ShowDialog(title, header, info, null, userName, icon, bundle, validateUser);
 }
예제 #9
0
 public static LoginData ShowDialog(String title, String header, String info,
     String userName, ImageSource icon, SkinBundle bundle)
 {
     return ShowDialog(title, header, info, null, userName, icon, bundle);
 }
 public static String ShowDialog(String title, String header, String info, ImageSource icon,
     SkinBundle bundle)
 {
     return ShowDialog(title, header, info, icon, bundle, null);
 }
예제 #11
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;
        }
예제 #12
0
 public static MessageResults ShowDialog(
     String message, String title, MessageButtons button,
     ImageSource image, SkinBundle bundle)
 {
     return ShowDialog(message, title, button, MessageIcons.None, image, bundle);
 }
예제 #13
0
 public static MessageResults ShowDialog(
     String message, String title, MessageButtons button, MessageIcons icon,
     SkinBundle bundle)
 {
     return ShowDialog(message, title, button, icon, null, bundle);
 }
예제 #14
0
        /// <summary>
        /// Show the dialog
        /// </summary>
        /// <param name="title">Dialogs title</param>
        /// <param name="info">Info-text</param>
        /// <param name="action">Working action</param>
        /// <param name="bundle">Skin-Bundle</param>
        /// <returns>TRUE, if the dialog was not canceled and there are no exceptions in action thread</returns>
        public static bool ShowDialog(String title, String info, WorkingActionHandler action, SkinBundle bundle)
        {
            WorkingDialogEx dlg = new WorkingDialogEx();
            dlg.Title = title;
            dlg.lblInfo.Content = info;
            dlg.action = action;

            if (bundle != null)
            {
                dlg.Resources.Source = bundle.XAMLSkinPath;
                dlg.Style = (Style)dlg.Resources[bundle.WindowTemplateKey];
            }

            return dlg.ShowDialog().GetValueOrDefault(false);
        }