@@ -103,11 +103,6 @@ public void ChangePageCommand(string selected_item)
103
103
104
104
sideBarBtns [ ind ] . background = _themeService . IsLightTheme ? ColorCon . Convert ( "#FCFCFC" ) : ColorCon . Convert ( "#36393F" ) ;
105
105
if ( currentPage != Pages [ ind ] ) pageService . Page = Pages [ ind ] ;
106
-
107
- if ( selected_item == "Settings" )
108
- {
109
- notifyManager . CreateNotification ( "Simple test" , 10 ) ;
110
- }
111
106
}
112
107
#region Color
113
108
private SolidColorBrush _backgroundColor ;
@@ -209,6 +204,7 @@ public ObservableCollection<NotifyObject> notificationList
209
204
}
210
205
211
206
private List < NotifyObject > WaitingNotifications = new List < NotifyObject > ( ) ;
207
+ private List < LiveNotification > liveNotifications = new List < LiveNotification > ( ) ;
212
208
private void showNotification ( object sender , EventArgs e )
213
209
{
214
210
var notification = sender as NotifyObject ;
@@ -229,22 +225,46 @@ private void showNotification(object sender, EventArgs e)
229
225
Interval = TimeSpan . FromSeconds ( notification . Delay ) ,
230
226
IsEnabled = true
231
227
} ;
228
+ liveNotifications . Add ( new LiveNotification ( ) { timer = closeTimer , notification = notification } ) ;
232
229
closeTimer . Tick += CloseNotification ;
233
230
}
234
231
}
235
232
236
233
private void exitNotification ( object sender , EventArgs e )
237
234
{
238
235
var notification = sender as NotifyObject ;
236
+ var liveNotification = new LiveNotification ( ) ;
237
+ foreach ( var _liveNotification in liveNotifications )
238
+ {
239
+ if ( _liveNotification . notification == notification )
240
+ {
241
+ liveNotification = _liveNotification ;
242
+ break ;
243
+ }
244
+ }
239
245
notificationList . Remove ( notification ) ;
240
246
UpdateNotification ( ) ;
247
+ liveNotification . timer . Stop ( ) ;
248
+ liveNotifications . Remove ( liveNotification ) ;
241
249
}
242
250
243
251
private void CloseNotification ( object sender , EventArgs e )
244
252
{
245
- if ( notificationList . Count > 0 ) notificationList . RemoveAt ( 0 ) ;
253
+ var timer = sender as DispatcherTimer ;
254
+ var liveNotification = new LiveNotification ( ) ;
255
+ foreach ( var _liveNotification in liveNotifications )
256
+ {
257
+ if ( _liveNotification . timer == timer )
258
+ {
259
+ liveNotification = _liveNotification ;
260
+ break ;
261
+ }
262
+ }
263
+
264
+ notificationList . Remove ( liveNotification . notification ) ;
265
+ liveNotifications . Remove ( liveNotification ) ;
246
266
UpdateNotification ( ) ;
247
- ( sender as DispatcherTimer ) . Stop ( ) ;
267
+ timer . Stop ( ) ;
248
268
}
249
269
250
270
private void UpdateNotification ( )
0 commit comments