using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Core.Commands; namespace Tango.FSE.Common.Notifications { /// /// Represents a base notification item class. /// /// /// public abstract class ItemBase : ExtendedObject, IDisposable { /// /// Occurs when the item has been closed. /// public event EventHandler Closed; /// /// Occurs when the item has been pressed. /// public event EventHandler Pressed; /// /// Gets or sets the remove action. /// public Action RemoveAction { get; set; } /// /// Gets or sets the view type. /// public abstract Type ViewType { get; } /// /// Gets or sets the close command. /// public RelayCommand CloseCommand { get; set; } /// /// Gets or sets the pressed command. /// /// Initializes a new instance of the class. /// public ItemBase() { CloseCommand = new RelayCommand(Close); PressedCommand = new RelayCommand(OnPreesed); } /// /// Called when the item has been pressed. /// protected virtual void OnPreesed() { Pressed?.Invoke(this, new EventArgs()); } /// /// Called after the close command has been raised. /// public virtual void Close() { RemoveAction?.Invoke(); Closed?.Invoke(this, new EventArgs()); } /// /// Disposes the item. /// public void Dispose() { Close(); } } }