Winify – Blame information for rev 22

Subversion Repositories:
Rev:
Rev Author Line No. Line
11 office 1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Linq;
6 using System.Threading;
7 using System.Threading.Tasks;
8 using System.Windows.Forms;
9 using Microsoft.Win32;
22 office 10 using ToastNotifications;
11 office 11 using Winify.Gotify;
12  
13 namespace Winify
14 {
15 public class NotificationManager : IDisposable
16 {
17 #region Private Delegates, Events, Enums, Properties, Indexers and Fields
18  
19 private readonly TaskScheduler _uiScheduler;
20  
21 #endregion
22  
23 #region Constructors, Destructors and Finalizers
24  
25 public NotificationManager(TaskScheduler uiScheduler) : this()
26 {
27 _uiScheduler = uiScheduler;
28 }
29  
30 private NotificationManager()
31 {
32 }
33  
34 public void Dispose()
35 {
36 }
37  
38 #endregion
39  
40 #region Public Methods
41  
15 office 42 public void ShowNotification(GotifyNotificationEventArgs e, Announcements.Announcements notifications)
11 office 43 {
44 Task.Factory.StartNew(() =>
45 {
15 office 46 var settings =
47 notifications.Announcement.FirstOrDefault(
22 office 48 announcement => announcement.AppId == e.Notification.AppId);
11 office 49  
22 office 50 Notification notification;
15 office 51 switch (settings == null)
52 {
53 case true:
22 office 54 notification = new Notification($"{e.Notification.Title} ({e.Notification.AppId})",
55 e.Notification.Message, 5000, e.Image, FormAnimator.AnimationMethod.Slide,
56 FormAnimator.AnimationDirection.Up);
15 office 57 break;
58 default:
22 office 59 notification = new Notification($"{e.Notification.Title} ({e.Notification.AppId})",
60 e.Notification.Message, settings.LingerTime, e.Image, FormAnimator.AnimationMethod.Slide,
61 FormAnimator.AnimationDirection.Up);
15 office 62 break;
63 }
64  
22 office 65 notification.Show();
11 office 66 }, CancellationToken.None, TaskCreationOptions.None, _uiScheduler);
67 }
68  
69 #endregion
70 }
71 }