|
using System.Windows;
using MsDesktopStackDemo.Events;
namespace MsDesktopStackDemo.View.Services
{
public class ViewServices
{
/// <summary>
/// Displays a message from the app to the user.
/// </summary>
/// <param name="category">The category of the message (e.g., warning, notification).</param>
/// <param name="caption">The message box caption.</param>
/// <param name="message">The message box text.</param>
public static void ShowUserMessage(UserMessageCategories category, string caption, string message)
{
// Set icon
var icon = MessageBoxImage.None;
switch (category)
{
case UserMessageCategories.Error:
icon = MessageBoxImage.Error;
break;
case UserMessageCategories.Warning:
icon = MessageBoxImage.Warning;
break;
case UserMessageCategories.Information:
icon = MessageBoxImage.Information;
break;
}
// Show message box
MessageBox.Show(message, caption, MessageBoxButton.OK, icon);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
David Veeneman is a financial planner and software developer. He is the author of "The Fortune in Your Future" (McGraw-Hill 1998). His company, Foresight Systems, develops planning and financial software.