Winify – Diff between revs 55 and 56

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 55 Rev 56
Line 18... Line 18...
18 using Toasts; 18 using Toasts;
19 using Winify.Gotify; 19 using Winify.Gotify;
20 using Winify.Settings; 20 using Winify.Settings;
21 using Winify.Utilities; 21 using Winify.Utilities;
22 using Winify.Utilities.Serialization; 22 using Winify.Utilities.Serialization;
-   23 using ScheduledContinuation = Toasts.ScheduledContinuation;
-   24 using Toasts = Toasts.Toasts;
Line 23... Line 25...
23   25  
24 namespace Winify 26 namespace Winify
25 { 27 {
26 public partial class MainForm : Form 28 public partial class MainForm : Form
27 { -  
28 private void LogViewToolStripMenuItem_Click(object sender, EventArgs e) -  
29 { -  
30 if (_logViewForm != null) return; -  
31   -  
32 _logViewForm = new LogViewForm(this, _memorySink, _cancellationToken); -  
33 _logViewForm.Closing += LogViewForm_Closing; -  
34 _logViewForm.Show(); -  
35 } -  
36   -  
37 private void LogViewForm_Closing(object sender, CancelEventArgs e) -  
38 { -  
39 if (_logViewForm == null) return; -  
40   -  
41 _logViewForm.Closing -= LogViewForm_Closing; -  
42 _logViewForm.Close(); -  
43 _logViewForm = null; -  
44 } -  
45   29 {
Line 46... Line 30...
46 #region Public Enums, Properties and Fields 30 #region Public Enums, Properties and Fields
Line 47... Line 31...
47   31  
Line 69... Line 53...
69   53  
Line 70... Line 54...
70 private LogViewForm _logViewForm; 54 private LogViewForm _logViewForm;
Line -... Line 55...
-   55  
-   56 private readonly LogMemorySink _memorySink;
71   57  
Line 72... Line 58...
72 private readonly LogMemorySink _memorySink; 58 private readonly global::Toasts.Toasts _toasts;
Line 73... Line 59...
73   59  
74 #endregion 60 #endregion
75   61  
76 #region Constructors, Destructors and Finalizers 62 #region Constructors, Destructors and Finalizers
Line 77... Line 63...
77   63  
-   64 public MainForm()
-   65 {
78 public MainForm() 66 _cancellationTokenSource = new CancellationTokenSource();
Line 79... Line 67...
79 { 67 _cancellationToken = _cancellationTokenSource.Token;
80 _cancellationTokenSource = new CancellationTokenSource(); 68  
81 _cancellationToken = _cancellationTokenSource.Token; 69 ChangedConfigurationContinuation = new ScheduledContinuation();
Line 137... Line 125...
137 gotifyConnection.Start(); 125 gotifyConnection.Start();
138 _gotifyConnections.Add(gotifyConnection); 126 _gotifyConnections.Add(gotifyConnection);
139 } 127 }
140 } 128 }
Line -... Line 129...
-   129  
-   130 private void LogViewToolStripMenuItem_Click(object sender, EventArgs e)
-   131 {
-   132 if (_logViewForm != null) return;
-   133  
-   134 _logViewForm = new LogViewForm(this, _memorySink, _cancellationToken);
-   135 _logViewForm.Closing += LogViewForm_Closing;
-   136 _logViewForm.Show();
-   137 }
-   138  
-   139 private void LogViewForm_Closing(object sender, CancelEventArgs e)
-   140 {
-   141 if (_logViewForm == null) return;
-   142  
-   143 _logViewForm.Closing -= LogViewForm_Closing;
-   144 _logViewForm.Close();
-   145 _logViewForm = null;
-   146 }
141   147  
142 private async void SettingsToolStripMenuItem_Click(object sender, EventArgs e) 148 private async void SettingsToolStripMenuItem_Click(object sender, EventArgs e)
143 { 149 {
144 if (_settingsForm == null) 150 if (_settingsForm == null)
145 { 151 {
Line 189... Line 195...
189 if (announcement.AppId == e.Notification.AppId) 195 if (announcement.AppId == e.Notification.AppId)
190 { 196 {
191 var configuredNotification = new ToastForm( 197 var configuredNotification = new ToastForm(
192 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", 198 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})",
193 e.Notification.Message, announcement.LingerTime, e.Image); 199 e.Notification.Message, announcement.LingerTime, e.Image);
194   200
195 Application.Run(configuredNotification); 201 await _toasts.Queue(configuredNotification);
Line 196... Line 202...
196   202  
197 return; 203 return;
Line 198... Line 204...
198 } 204 }
199   205  
200 if (Configuration.InfiniteToastDuration) 206 if (Configuration.InfiniteToastDuration)
201 { 207 {
202 var infiniteToastForm = new ToastForm( 208 var infiniteToastForm = new ToastForm(
Line 203... Line 209...
203 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", 209 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})",
Line 204... Line 210...
204 e.Notification.Message, e.Image); 210 e.Notification.Message, e.Image);
205   211  
Line 206... Line 212...
206 Application.Run(infiniteToastForm); 212 await _toasts.Queue(infiniteToastForm);
207   213  
208 return; 214 return;
209 } 215 }
210   216  
211 var toastForm = new ToastForm( 217 var toastForm = new ToastForm(
Line 212... Line 218...
212 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", 218 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})",
213 e.Notification.Message, Configuration.ToastDuration, e.Image); 219 e.Notification.Message, Configuration.ToastDuration, e.Image);
214   220