-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotificationsCenter.cs
More file actions
58 lines (41 loc) · 1.63 KB
/
NotificationsCenter.cs
File metadata and controls
58 lines (41 loc) · 1.63 KB
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
using NotificationAgent.UI.Abstract;
using System;
using System.Drawing;
using System.IO;
namespace NotificationAgent
{
public class NotificationsCenter<TNotificationView> where TNotificationView : GenericNotificationView, INotificationView
{
#region Fields
private IDisplayConfigurator<TNotificationView> displayManager;
#endregion
#region Constructors
public NotificationsCenter(IDisplayConfigurator<TNotificationView> displayManager)
{
this.displayManager = displayManager;
}
#endregion
#region Properties
private Stream NotificationSound { get; set; }
private Color NotificationColor { get; set; } = Color.AliceBlue;
private Color TextColor { get; set; } = Color.Black;
#endregion
#region Methods
public void SetupNotificationViewsDesign(Color notificationColor, Color textColor, Stream notificationSound)
{
this.NotificationColor = notificationColor;
this.TextColor = textColor;
this.NotificationSound = notificationSound;
}
public void DisplayNotification(string title, string details, Image image)
{
var notification = (TNotificationView)Activator.CreateInstance(typeof(TNotificationView), NotificationSound, NotificationColor, TextColor);
if (!displayManager.IsConfigured)
{
displayManager.SetupNotificationViewPositioning(notification.ClientRectangle);
}
displayManager.DisplayView(notification, title, details, image);
}
#endregion
}
}