aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/NotificationItem.cs
blob: f5e319fa0104f1d1117b82828658f0ae512ab80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Media;
using Tango.Core;

namespace Tango.PPC.Common.Notifications
{
    /// <summary>
    /// Represents a base notification item.
    /// </summary>
    /// <seealso cref="Tango.Core.ExtendedObject" />
    public abstract class NotificationItem : ExtendedObject, IDisposable
    {
        /// <summary>
        /// Gets or sets the condition.
        /// </summary>
        internal Func<bool> Condition { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [automatic check].
        /// </summary>
        internal bool AutoCheck { get; set; }

        /// <summary>
        /// Gets or sets the automatic check interval.
        /// </summary>
        internal TimeSpan AutoCheckInterval { get; set; }

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

        /// <summary>
        /// Gets or sets the check timer.
        /// </summary>
        internal Timer Timer { get; set; }

        private String _message;
        /// <summary>
        /// Gets or sets the notification message.
        /// </summary>
        public String Message
        {
            get { return _message; }
            set { _message = value; RaisePropertyChangedAuto(); }
        }

        /// <summary>
        /// Gets or sets the type of the view associated with this notification item.
        /// </summary>
        public abstract Type ViewType { get; }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (RemoveAction != null)
            {
                RemoveAction();
            }
        }
    }
}