using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.PPC.Common.Notifications.NotificationItems
{
///
/// Represents a simple text message notification item which can be inserted into the application notifications panel.
///
///
public class MessageNotificationItem : NotificationItem
{
///
/// Represents the available message notification types.
///
public enum MessageNotificationItemTypes
{
Info,
Success,
Warning,
Error,
Critical,
}
private String _message;
///
/// Gets or sets the message.
///
public String Message
{
get { return _message; }
set { _message = value; RaisePropertyChangedAuto(); }
}
private String _expandedMessage;
///
/// Gets or sets the extra message when the notification panel is expanded.
///
public String ExpandedMessage
{
get { return _expandedMessage; }
set { _expandedMessage = value; RaisePropertyChangedAuto(); }
}
private MessageNotificationItemTypes _messageType;
///
/// Gets or sets the type of the message.
///
public MessageNotificationItemTypes MessageType
{
get { return _messageType; }
set { _messageType = value; RaisePropertyChangedAuto(); }
}
///
/// Gets or sets the view type.
///
public override Type ViewType
{
get { return typeof(MessageNotificationItemView); }
}
///
/// Initializes a new instance of the class.
///
public MessageNotificationItem() : base()
{
}
///
/// Initializes a new instance of the class.
///
/// The message.
/// The expanded message.
/// The type.
/// The pressed action.
public MessageNotificationItem(String message, String expandedMessage, MessageNotificationItemTypes type, Action pressedAction, NotificationPriority priority = NotificationPriority.Normal) : this()
{
Message = message;
ExpandedMessage = expandedMessage;
MessageType = type;
Priority = priority;
Pressed += (_, __) => pressedAction?.Invoke();
}
///
/// Initializes a new instance of the class.
///
/// The message.
/// The type.
/// The pressed action.
public MessageNotificationItem(String message, MessageNotificationItemTypes type, Action pressedAction) : this(message, null, type, pressedAction)
{
}
///
/// Initializes a new instance of the class.
///
/// The message.
/// The expanded message.
/// The type.
public MessageNotificationItem(String message, String expandedMessage, MessageNotificationItemTypes type) : this(message, expandedMessage, type, null)
{
}
///
/// Initializes a new instance of the class.
///
/// The message.
/// The type.
public MessageNotificationItem(String message, MessageNotificationItemTypes type) : this(message, null, type)
{
}
///
/// Initializes a new instance of the class.
///
/// The message.
public MessageNotificationItem(String message) : this(message, MessageNotificationItemTypes.Info)
{
}
}
}