Winify
/trunk/Winify/Form1.cs |
@@ -23,6 +23,8 @@ |
|
private GotifyConnectionManager _gotifyConnectionManager; |
|
private NotificationManager _notificationManager; |
|
private SettingsForm _settingsForm; |
|
#endregion |
@@ -49,7 +51,10 @@ |
_servers = new global::Servers.Servers(); |
_servers.Server.CollectionChanged += Server_CollectionChanged; |
|
_notificationManager = new NotificationManager(TaskScheduler.FromCurrentSynchronizationContext()); |
|
_gotifyConnectionManager = new GotifyConnectionManager(_servers); |
_gotifyConnectionManager.GotifyNotification += GotifyConnectionManager_GotifyNotification; |
|
Task.Run(async () => |
{ |
@@ -76,9 +81,13 @@ |
Settings.Default.SettingsSaving -= Default_SettingsSaving; |
Settings.Default.PropertyChanged -= Default_PropertyChanged; |
|
_gotifyConnectionManager.GotifyNotification -= GotifyConnectionManager_GotifyNotification; |
_gotifyConnectionManager?.Dispose(); |
_gotifyConnectionManager = null; |
|
_notificationManager?.Dispose(); |
_notificationManager = null; |
|
components.Dispose(); |
} |
|
@@ -89,6 +98,11 @@ |
|
#region Event Handlers |
|
private void GotifyConnectionManager_GotifyNotification(object sender, GotifyNotificationEventArgs e) |
{ |
_notificationManager.ShowNotification(e); |
} |
|
private async void Server_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
{ |
switch (await ServersSerialization.Serialize(_servers, Constants.ServersFile)) |