@@ -103,11 +103,6 @@ public void ChangePageCommand(string selected_item)
103103
104104 sideBarBtns [ ind ] . background = _themeService . IsLightTheme ? ColorCon . Convert ( "#FCFCFC" ) : ColorCon . Convert ( "#36393F" ) ;
105105 if ( currentPage != Pages [ ind ] ) pageService . Page = Pages [ ind ] ;
106-
107- if ( selected_item == "Settings" )
108- {
109- notifyManager . CreateNotification ( "Simple test" , 10 ) ;
110- }
111106 }
112107 #region Color
113108 private SolidColorBrush _backgroundColor ;
@@ -209,6 +204,7 @@ public ObservableCollection<NotifyObject> notificationList
209204 }
210205
211206 private List < NotifyObject > WaitingNotifications = new List < NotifyObject > ( ) ;
207+ private List < LiveNotification > liveNotifications = new List < LiveNotification > ( ) ;
212208 private void showNotification ( object sender , EventArgs e )
213209 {
214210 var notification = sender as NotifyObject ;
@@ -229,22 +225,46 @@ private void showNotification(object sender, EventArgs e)
229225 Interval = TimeSpan . FromSeconds ( notification . Delay ) ,
230226 IsEnabled = true
231227 } ;
228+ liveNotifications . Add ( new LiveNotification ( ) { timer = closeTimer , notification = notification } ) ;
232229 closeTimer . Tick += CloseNotification ;
233230 }
234231 }
235232
236233 private void exitNotification ( object sender , EventArgs e )
237234 {
238235 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+ }
239245 notificationList . Remove ( notification ) ;
240246 UpdateNotification ( ) ;
247+ liveNotification . timer . Stop ( ) ;
248+ liveNotifications . Remove ( liveNotification ) ;
241249 }
242250
243251 private void CloseNotification ( object sender , EventArgs e )
244252 {
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 ) ;
246266 UpdateNotification ( ) ;
247- ( sender as DispatcherTimer ) . Stop ( ) ;
267+ timer . Stop ( ) ;
248268 }
249269
250270 private void UpdateNotification ( )
0 commit comments