Ejemplo n.º 1
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();
        }
        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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 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;
        }