Winify – Diff between revs 43 and 44

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 43 Rev 44
Line 22... Line 22...
22   22  
23 namespace Winify 23 namespace Winify
24 { 24 {
25 public partial class MainForm : Form 25 public partial class MainForm : Form
-   26 {
-   27 private void LogViewToolStripMenuItem_Click(object sender, EventArgs e)
-   28 {
-   29 if (_logViewForm != null) return;
-   30  
-   31 _logViewForm = new LogViewForm(this, _memorySink, _cancellationToken);
-   32 _logViewForm.Closing += LogViewForm_Closing;
-   33 _logViewForm.Show();
-   34 }
-   35  
-   36 private void LogViewForm_Closing(object sender, CancelEventArgs e)
-   37 {
-   38 if (_logViewForm == null) return;
-   39  
-   40 _logViewForm.Closing -= LogViewForm_Closing;
-   41 _logViewForm.Close();
-   42 _logViewForm = null;
-   43 }
26 { 44  
Line 27... Line 45...
27 #region Public Enums, Properties and Fields 45 #region Public Enums, Properties and Fields
Line 28... Line 46...
28   46  
Line 110... Line 128...
110   128  
111 var servers = await LoadServers(); 129 var servers = await LoadServers();
112 _gotifyConnections = new ConcurrentBag<GotifyConnection>(); 130 _gotifyConnections = new ConcurrentBag<GotifyConnection>();
113 foreach (var server in servers.Server) 131 foreach (var server in servers.Server)
114 { 132 {
115 var gotifyConnection = new GotifyConnection(server); 133 var gotifyConnection = new GotifyConnection(server, Configuration);
116 gotifyConnection.GotifyNotification += GotifyConnection_GotifyNotification; 134 gotifyConnection.GotifyNotification += GotifyConnection_GotifyNotification;
117 gotifyConnection.Start(); 135 gotifyConnection.Start();
118 _gotifyConnections.Add(gotifyConnection); 136 _gotifyConnections.Add(gotifyConnection);
119 } 137 }
Line 147... Line 165...
147 gotifyConnection = null; 165 gotifyConnection = null;
148 } 166 }
Line 149... Line 167...
149   167  
150 foreach (var server in e.Servers.Server) 168 foreach (var server in e.Servers.Server)
151 { 169 {
152 var gotifyConnection = new GotifyConnection(server); 170 var gotifyConnection = new GotifyConnection(server, Configuration);
153 gotifyConnection.GotifyNotification += GotifyConnection_GotifyNotification; 171 gotifyConnection.GotifyNotification += GotifyConnection_GotifyNotification;
154 gotifyConnection.Start(); 172 gotifyConnection.Start();
155 _gotifyConnections.Add(gotifyConnection); 173 _gotifyConnections.Add(gotifyConnection);
156 } 174 }
Line 159... Line 177...
159 private async void GotifyConnection_GotifyNotification(object sender, GotifyNotificationEventArgs e) 177 private async void GotifyConnection_GotifyNotification(object sender, GotifyNotificationEventArgs e)
160 { 178 {
161 var announcements = await LoadAnnouncements(); 179 var announcements = await LoadAnnouncements();
Line 162... Line 180...
162   180  
163 foreach (var announcement in announcements.Announcement) -  
164 { 181 foreach (var announcement in announcements.Announcement)
165 if (announcement.AppId == e.Notification.AppId) 182 if (announcement.AppId == e.Notification.AppId)
166 { 183 {
167 var configuredNotification = new ToastForm( 184 var configuredNotification = new ToastForm(
168 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", 185 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})",
Line 169... Line 186...
169 e.Notification.Message, announcement.LingerTime, e.Image); 186 e.Notification.Message, announcement.LingerTime, e.Image);
Line 170... Line 187...
170   187  
171 configuredNotification.Show(); 188 Application.Run(configuredNotification);
172   -  
Line 173... Line 189...
173 return; 189  
174 } 190 return;
175 } 191 }
Line 176... Line 192...
176   192  
177 var notification = new ToastForm( 193 var notification = new ToastForm(
Line 178... Line 194...
178 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", 194 $"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})",
179 e.Notification.Message, 5000, e.Image); 195 e.Notification.Message, 5000, e.Image);
180   196  
181 notification.Show(); -  
182 } -  
183   -  
Line 184... Line 197...
184 private void SettingsForm_Closing(object sender, CancelEventArgs e) 197 Application.Run(notification);
185 { 198 }
186 if (_settingsForm == null) 199  
187 { 200 private void SettingsForm_Closing(object sender, CancelEventArgs e)
188 return; 201 {
Line 189... Line 202...
189 } 202 if (_settingsForm == null) return;
190   203  
191 _settingsForm.Save -= SettingsForm_Save; 204 _settingsForm.Save -= SettingsForm_Save;
192 _settingsForm.Closing -= SettingsForm_Closing; -  
193 _settingsForm.Dispose(); -  
194 _settingsForm = null; -  
Line 195... Line 205...
195 } 205 _settingsForm.Closing -= SettingsForm_Closing;
196   206 _settingsForm.Dispose();
197 private void AboutToolStripMenuItem_Click(object sender, EventArgs e) 207 _settingsForm = null;
198 { 208 }
Line 199... Line 209...
199 if (_aboutForm != null) 209  
200 { 210 private void AboutToolStripMenuItem_Click(object sender, EventArgs e)
201 return; 211 {
202 } -  
203   -  
204 _aboutForm = new AboutForm(); -  
Line 205... Line 212...
205 _aboutForm.Closing += AboutForm_Closing; 212 if (_aboutForm != null) return;
206 _aboutForm.Show(); 213  
207 } 214 _aboutForm = new AboutForm();
208   215 _aboutForm.Closing += AboutForm_Closing;
Line 384... Line 391...
384 return new Servers.Servers(); 391 return new Servers.Servers();
385 } 392 }
386 } 393 }
Line 387... Line 394...
387   394  
388 #endregion -  
389   -  
390 private void LogViewToolStripMenuItem_Click(object sender, EventArgs e) -  
391 { -  
392 if (_logViewForm != null) -  
393 { -  
394 return; -  
395 } -  
396   -  
397 _logViewForm = new LogViewForm(this, _memorySink, _cancellationToken); -  
398 _logViewForm.Closing += LogViewForm_Closing; -  
399 _logViewForm.Show(); -  
400 } -  
401   -  
402 private void LogViewForm_Closing(object sender, CancelEventArgs e) -  
403 { -  
404 if (_logViewForm == null) -  
405 { -  
406 return; -  
407 } -  
408   -  
409 _logViewForm.Closing -= LogViewForm_Closing; -  
410 _logViewForm.Close(); -  
411 _logViewForm = null; -  
412 } 395 #endregion
413 } 396 }
414 } 397 }