Beispiel #1
0
        /// <summary>
        /// Shows a message and returns the users response.
        /// </summary>
        /// <param name="messageBoxSettings">The message to show including text, title and
        /// message type, buttons and whether to enable copying the message to a clipboard</param>
        /// <returns>The users response to the message.</returns>
        public static MessageBoxResult ShowMessage(MessageBoxSettings messageBoxSettings)
        {
            var model = new MessageBoxViewModel(messageBoxSettings);
            var view  = new MessageBoxView();

            view.DataContext = model;
            view.ShowDialog();
            messageBoxSettings.MessageBoxResult = model.MessageBoxResult;
            return(messageBoxSettings.MessageBoxResult);
        }
Beispiel #2
0
        /// <summary>
        /// Shows a message and returns the users response.
        /// </summary>
        /// <param name="messageBoxSettings">The message to show including text, title and
        /// message type, buttons and whether to enable copying the message to a clipboard</param>
        /// <returns>The users response to the message.</returns>
        public static MessageBoxResult ShowMessage(MessageBoxSettings messageBoxSettings)
        {
            if (messageBoxSettings == null)
            {
                throw new ArgumentNullException(nameof(messageBoxSettings));
            }

            var model = new MessageBoxViewModel(messageBoxSettings);
            var view  = new MessageBoxView
            {
                DataContext = model
            };

            view.ShowDialog();
            messageBoxSettings.MessageBoxResult = model.MessageBoxResult;
            return(messageBoxSettings.MessageBoxResult);
        }