Example #1
0
        public static WindowMessageResult ShowDialog(string message, string title, WindowMessageButtons buttons, WindowMessageImage image, Window owner,
                                                     WindowStartupLocation windowStartupLocation = WindowStartupLocation.CenterOwner, WindowMessageTextType windowMessageTextType = WindowMessageTextType.TextBlock, FontFamily fontFamily = null, double fontSize = 12)
        {
            WindowMessage windowMessage = new WindowMessage(message, title, buttons, image, owner, windowStartupLocation, windowMessageTextType, fontFamily, fontSize);

            ((Window)windowMessage).ShowDialog();
            return(windowMessage.Result);
        }
Example #2
0
 // Sets Window Title, Message Header, Message Body, Message HyperLink Text, Message HyperLink Uri, Message Buttons, Message Icon, and Color Set.
 public static WindowMessageResult Show(string windowTitle, string contentHeader, string contentBody, string hyperLinkText, string hyperLinkUri, WindowMessageButtons windowMessageButtons, WindowMessageIcon windowMessageIcon, WindowMessageColorSet windowMessageColorSet)
 {
     return(OpenWindowMessage(dialogDataBuilder(windowTitle, contentHeader, contentBody, hyperLinkText, hyperLinkUri, windowMessageButtons, windowMessageIcon)));
 }
Example #3
0
 // Sets Window Title, Message Header, Message Body, Message HyperLink, Message Buttons, and Message Icon.
 public static WindowMessageResult Show(string windowTitle, string contentHeader, string contentBody, string hyperLink, WindowMessageButtons windowMessageButtons, WindowMessageIcon windowMessageIcon)
 {
     return(OpenWindowMessage(dialogDataBuilder(windowTitle, contentHeader, contentBody, "", hyperLink, windowMessageButtons, windowMessageIcon)));
 }
 // Sets Window Title, Message Header, Message Body, Message Buttons, and Message Icon on target window.
 public static WindowMessageResult Show(Window parentWindow, string windowTitle, string contentHeader, string contentBody, WindowMessageButtons windowMessageButtons, WindowMessageIcon windowMessageIcon)
 {
     return(OpenWindowMessage(dialogDataBuilder(windowTitle, contentHeader, contentBody, "", "", windowMessageButtons, windowMessageIcon), parentWindow));
 }
        public WindowMessage(string message, string title, WindowMessageButtons buttons, WindowMessageImage image, Window owner, WindowStartupLocation windowStartupLocation, WindowMessageTextType windowMessageTextType, FontFamily fontFamily = null, double fontSize = 12)
        {
            InitializeComponent();

            if (owner != null)
            {
                Owner = owner;
            }
            WindowStartupLocation = windowStartupLocation;

            Title = title;
            TextBlock_Message.Text = message;
            TextBox_Message.Text = message;
            TextBlock_Message.FontSize = fontSize;
            TextBox_Message.FontSize = fontSize;

            switch (windowMessageTextType)
            {
                case WindowMessageTextType.TextBlock:
                    TextBlock_Message.Visibility = Visibility.Visible;
                    TextBox_Message.Visibility = Visibility.Collapsed;
                    break;
                case WindowMessageTextType.TextBox:
                    TextBlock_Message.Visibility = Visibility.Collapsed;
                    TextBox_Message.Visibility = Visibility.Visible;
                    break;
            }

            Image_Error.Visibility = Visibility.Collapsed;
            Image_Information.Visibility = Visibility.Collapsed;
            Image_Question.Visibility = Visibility.Collapsed;
            Image_Warning.Visibility = Visibility.Collapsed;
            switch (image)
            {
                case WindowMessageImage.Error:
                    Image_Error.Visibility = Visibility.Visible;
                    break;
                case WindowMessageImage.Information:
                    Image_Information.Visibility = Visibility.Visible;
                    break;
                case WindowMessageImage.Question:
                    Image_Question.Visibility = Visibility.Visible;
                    break;
                case WindowMessageImage.Warning:
                    Image_Warning.Visibility = Visibility.Visible;
                    break;
                default:
                    break;
            }

            Button_OK.Visibility = Visibility.Collapsed;
            Button_Yes.Visibility = Visibility.Collapsed;
            Button_No.Visibility = Visibility.Collapsed;
            Button_Cancel.Visibility = Visibility.Collapsed;
            switch (buttons)
            {
                case WindowMessageButtons.OK:
                    Button_OK.Visibility = Visibility.Visible;
                    break;
                case WindowMessageButtons.OKCancel:
                    Button_OK.Visibility = Visibility.Visible;
                    Button_OK.Margin = new Thickness(0, 0, 5, 0);
                    Button_Cancel.Visibility = Visibility.Visible;
                    break;
                case WindowMessageButtons.YesNo:
                    Button_Yes.Visibility = Visibility.Visible;
                    Button_Yes.Margin = new Thickness(0, 0, 5, 0);
                    Button_No.Visibility = Visibility.Visible;
                    break;
                case WindowMessageButtons.YesNoCancel:
                    Button_Yes.Visibility = Visibility.Visible;
                    Button_Yes.Margin = new Thickness(0, 0, 5, 0);
                    Button_No.Visibility = Visibility.Visible;
                    Button_No.Margin = new Thickness(0, 0, 5, 0);
                    Button_Cancel.Visibility = Visibility.Visible;
                    break;
                default:
                    Button_OK.Visibility = Visibility.Visible;
                    break;
            }

            if (fontFamily != null)
            {
                TextBlock_Message.FontFamily = fontFamily;
                TextBox_Message.FontFamily = fontFamily;
            }
        }
 public static WindowMessageResult ShowDialog(string message, string title, WindowMessageButtons buttons, WindowMessageImage image, Window owner,
     WindowStartupLocation windowStartupLocation = WindowStartupLocation.CenterOwner, WindowMessageTextType windowMessageTextType = WindowMessageTextType.TextBlock, FontFamily fontFamily = null, double fontSize = 12)
 {
     WindowMessage windowMessage = new WindowMessage(message, title, buttons, image, owner, windowStartupLocation, windowMessageTextType, fontFamily, fontSize);
     ((Window)windowMessage).ShowDialog();
     return windowMessage.Result;
 }
Example #7
0
        } = new WindowMessageColorSet();                                                          // Plans for the future.

        // Takes the arguments from the overload methods to create a DialogData object. This is what is passed to the DialogService and used to open the MessageBox Enhanced window.
        private static DialogData dialogDataBuilder(
            string windowTitle   = "",
            string contentHeader = "",
            string contentBody   = "",
            string hyperLinkText = "",
            string hyperLinkUri  = "",
            WindowMessageButtons windowMessageButtons   = WindowMessageButtons.Ok,
            WindowMessageIcon windowMessageIcon         = WindowMessageIcon.Information,
            WindowMessageColorSet windowMessageColorSet = null)
        {
            DialogData data = new DialogData()
            {
                WindowTitle    = windowTitle,
                ContentBody    = contentBody,
                ContentHeader  = contentHeader,
                HyperLinkText  = hyperLinkText,
                HyperLinkUri   = hyperLinkUri,
                MessageButtons = windowMessageButtons,
                MessageIcon    = windowMessageIcon,
            };

            if (windowMessageColorSet == null)
            {
                data.Background                  = ColorSets.Background;
                data.ContentHeaderColor          = ColorSets.ContentHeaderColor;
                data.ContentBodyColor            = ColorSets.ContentBodyColor;
                data.HyperLinkColor              = ColorSets.HyperLinkColor;
                data.HyperLinkMouseOverColor     = ColorSets.HyperLinkMouseOverColor;
                data.HyperLinkMouseDisabledColor = ColorSets.HyperLinkMouseDisabledColor;
            }
            else
            {
                if (windowMessageColorSet.Background == null)
                {
                    data.Background = ColorSets.Background;
                }

                if (windowMessageColorSet.ContentHeaderColor == null)
                {
                    data.ContentHeaderColor = ColorSets.ContentHeaderColor;
                }

                if (windowMessageColorSet.ContentBodyColor == null)
                {
                    data.ContentBodyColor = ColorSets.ContentBodyColor;
                }

                if (windowMessageColorSet.HyperLinkColor == null)
                {
                    data.HyperLinkColor = ColorSets.HyperLinkColor;
                }

                if (windowMessageColorSet.HyperLinkMouseOverColor == null)
                {
                    data.HyperLinkMouseOverColor = ColorSets.HyperLinkMouseOverColor;
                }

                if (windowMessageColorSet.HyperLinkMouseDisabledColor == null)
                {
                    data.HyperLinkMouseDisabledColor = ColorSets.HyperLinkMouseDisabledColor;
                }
            }

            return(data);
        }
 // Sets Window Title, Message Header, Message Body, Message HyperLink Text, Message HyperLink Uri, Message Buttons, and Message Icon on target window.
 public static WindowMessageResult Show(ViewModelBase viewModelBase, string windowTitle, string contentHeader, string contentBody, string hyperLinkText, string hyperLinkUri, WindowMessageButtons windowMessageButtons, WindowMessageIcon windowMessageIcon)
 {
     return(OpenWindowMessage(dialogDataBuilder(windowTitle, contentHeader, contentBody, hyperLinkText, hyperLinkUri, windowMessageButtons, windowMessageIcon), viewModelBase));
 }
 // Sets Window Title, Message Content, Message Buttons, and Message Icon on target window.
 public static WindowMessageResult Show(ViewModelBase viewModelBase, string windowTitle, string contentHeader, WindowMessageButtons windowMessageButtons, WindowMessageIcon windowMessageIcon)
 {
     return(OpenWindowMessage(dialogDataBuilder(windowTitle, contentHeader, "", "", "", windowMessageButtons, windowMessageIcon), viewModelBase));
 }
Example #10
0
        public WindowMessage(string message, string title, WindowMessageButtons buttons, WindowMessageImage image, Window owner, WindowStartupLocation windowStartupLocation, WindowMessageTextType windowMessageTextType, FontFamily fontFamily = null, double fontSize = 12)
        {
            InitializeComponent();

            if (owner != null)
            {
                Owner = owner;
            }
            WindowStartupLocation = windowStartupLocation;

            Title = title;
            TextBlock_Message.Text     = message;
            TextBox_Message.Text       = message;
            TextBlock_Message.FontSize = fontSize;
            TextBox_Message.FontSize   = fontSize;

            switch (windowMessageTextType)
            {
            case WindowMessageTextType.TextBlock:
                TextBlock_Message.Visibility = Visibility.Visible;
                TextBox_Message.Visibility   = Visibility.Collapsed;
                break;

            case WindowMessageTextType.TextBox:
                TextBlock_Message.Visibility = Visibility.Collapsed;
                TextBox_Message.Visibility   = Visibility.Visible;
                break;
            }


            Image_Error.Visibility       = Visibility.Collapsed;
            Image_Information.Visibility = Visibility.Collapsed;
            Image_Question.Visibility    = Visibility.Collapsed;
            Image_Warning.Visibility     = Visibility.Collapsed;
            switch (image)
            {
            case WindowMessageImage.Error:
                Image_Error.Visibility = Visibility.Visible;
                break;

            case WindowMessageImage.Information:
                Image_Information.Visibility = Visibility.Visible;
                break;

            case WindowMessageImage.Question:
                Image_Question.Visibility = Visibility.Visible;
                break;

            case WindowMessageImage.Warning:
                Image_Warning.Visibility = Visibility.Visible;
                break;

            default:
                break;
            }

            Button_OK.Visibility     = Visibility.Collapsed;
            Button_Yes.Visibility    = Visibility.Collapsed;
            Button_No.Visibility     = Visibility.Collapsed;
            Button_Cancel.Visibility = Visibility.Collapsed;
            switch (buttons)
            {
            case WindowMessageButtons.OK:
                Button_OK.Visibility = Visibility.Visible;
                break;

            case WindowMessageButtons.OKCancel:
                Button_OK.Visibility     = Visibility.Visible;
                Button_OK.Margin         = new Thickness(0, 0, 5, 0);
                Button_Cancel.Visibility = Visibility.Visible;
                break;

            case WindowMessageButtons.YesNo:
                Button_Yes.Visibility = Visibility.Visible;
                Button_Yes.Margin     = new Thickness(0, 0, 5, 0);
                Button_No.Visibility  = Visibility.Visible;
                break;

            case WindowMessageButtons.YesNoCancel:
                Button_Yes.Visibility    = Visibility.Visible;
                Button_Yes.Margin        = new Thickness(0, 0, 5, 0);
                Button_No.Visibility     = Visibility.Visible;
                Button_No.Margin         = new Thickness(0, 0, 5, 0);
                Button_Cancel.Visibility = Visibility.Visible;
                break;

            default:
                Button_OK.Visibility = Visibility.Visible;
                break;
            }

            if (fontFamily != null)
            {
                TextBlock_Message.FontFamily = fontFamily;
                TextBox_Message.FontFamily   = fontFamily;
            }
        }