Winify
/trunk/Notifications/Announcement.cs |
@@ -0,0 +1,107 @@ |
using System.ComponentModel; |
using System.Runtime.CompilerServices; |
using System.Xml.Serialization; |
using Announcements.Annotations; |
|
namespace Announcements |
{ |
public class Announcement : INotifyPropertyChanged |
{ |
#region Public Enums, Properties and Fields |
|
[XmlIgnore] |
public string Id => _appId.ToString(); |
|
[XmlElement(ElementName = "AppId")] |
public int AppId |
{ |
get => _appId; |
set |
{ |
if (value == _appId) |
{ |
return; |
} |
|
_appId = value; |
OnPropertyChanged(); |
} |
} |
|
[XmlElement(ElementName = "LingerTime")] |
public int LingerTime |
{ |
get => _lingerTime; |
set |
{ |
if (value == _lingerTime) |
{ |
return; |
} |
|
_lingerTime = value; |
OnPropertyChanged(); |
} |
} |
|
[XmlElement(ElementName = "Speak")] |
public string Speak |
{ |
get => _speak; |
set |
{ |
if (value == _speak) |
{ |
return; |
} |
|
_speak = value; |
OnPropertyChanged(); |
} |
} |
|
#endregion |
|
#region Private Delegates, Events, Enums, Properties, Indexers and Fields |
|
private int _appId; |
|
private int _lingerTime; |
|
private string _speak; |
|
#endregion |
|
#region Constructors, Destructors and Finalizers |
|
[UsedImplicitly] |
public Announcement() |
{ |
} |
|
public Announcement(int appId, int lingerTime, string speak) : this() |
{ |
AppId = appId; |
LingerTime = lingerTime; |
Speak = speak; |
} |
|
#endregion |
|
#region Interface |
|
public event PropertyChangedEventHandler PropertyChanged; |
|
#endregion |
|
#region Private Methods |
|
[NotifyPropertyChangedInvocator] |
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
{ |
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
} |
|
#endregion |
} |
} |