aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/App.xaml
blob: 3a30cbc372c5c0ca06a9a1aba57dc461332feccc (plain)
1
2
3
4
5
6
7
8
9
10
11
<Application x:Class="Tango.PPC.Storage.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
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.PPC.Common.Notifications
{
    /// <summary>
    /// Represents a base notification item class.
    /// </summary>
    /// <seealso cref="Tango.Core.ExtendedObject" />
    /// <seealso cref="System.IDisposable" />
    public abstract class ItemBase : ExtendedObject, IDisposable
    {
        /// <summary>
        /// Occurs when the item has been closed.
        /// </summary>
        public event EventHandler Closed;

        /// <summary>
        /// Occurs when the item has been pressed.
        /// </summary>
        public event EventHandler Pressed;

        /// <summary>
        /// Gets or sets the remove action.
        /// </summary>
        internal Action RemoveAction { get; set; }

        /// <summary>
        /// Gets or sets the view type.
        /// </summary>
        public abstract Type ViewType { get; }

        /// <summary>
        /// Gets or sets the close command.
        /// </summary>
        public RelayCommand CloseCommand { get; set; }

        /// <summary>
        /// Gets or sets the pressed command.
        /// </summary
        public RelayCommand PressedCommand { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ItemBase"/> class.
        /// </summary>
        public ItemBase()
        {
            CloseCommand = new RelayCommand(Close);
            PressedCommand = new RelayCommand(OnPreesed);
        }

        /// <summary>
        /// Called when the item has been pressed.
        /// </summary>
        protected virtual void OnPreesed()
        {
            Pressed?.Invoke(this, new EventArgs());
        }

        /// <summary>
        /// Called after the close command has been raised.
        /// </summary>
        public virtual void Close()
        {
            RemoveAction?.Invoke();
            Closed?.Invoke(this, new EventArgs());
        }

        /// <summary>
        /// Disposes the item.
        /// </summary>
        public void Dispose()
        {
            Close();
        }
    }
}