@@ -98,9 +98,9 @@ private async void Items_CollectionChanged(object? sender, NotifyCollectionChang
9898 switch ( e . Action )
9999 {
100100 case NotifyCollectionChangedAction . Add when e . NewItems is not null :
101- {
102- if ( e . NewItems [ 0 ] is not ShelfItem shelfItem )
103- return ;
101+ {
102+ if ( e . NewItems [ 0 ] is not ShelfItem shelfItem )
103+ return ;
104104
105105 var parentPath = SystemIO . Path . GetDirectoryName ( shelfItem . Inner . Id ) ?? string . Empty ;
106106 if ( _watchers . TryGetValue ( parentPath , out var reference ) )
@@ -113,22 +113,22 @@ private async void Items_CollectionChanged(object? sender, NotifyCollectionChang
113113 if ( await shelfItem . Inner . GetParentAsync ( ) is not IMutableFolder mutableFolder )
114114 return ;
115115
116- // Register new watcher
117- var watcher = await mutableFolder . GetFolderWatcherAsync ( ) ;
118- watcher . CollectionChanged += Watcher_CollectionChanged ;
116+ // Register new watcher
117+ var watcher = await mutableFolder . GetFolderWatcherAsync ( ) ;
118+ watcher . CollectionChanged += Watcher_CollectionChanged ;
119119
120120 _watchers . Add ( parentPath , new ( watcher , 1 ) ) ;
121121 break ;
122122 }
123123
124124 case NotifyCollectionChangedAction . Remove when e . OldItems is not null :
125- {
126- if ( e . OldItems [ 0 ] is not ShelfItem shelfItem )
127- return ;
125+ {
126+ if ( e . OldItems [ 0 ] is not ShelfItem shelfItem )
127+ return ;
128128
129- var parentPath = SystemIO . Path . GetDirectoryName ( shelfItem . Inner . Id ) ?? string . Empty ;
130- if ( ! _watchers . TryGetValue ( parentPath , out var reference ) )
131- return ;
129+ var parentPath = SystemIO . Path . GetDirectoryName ( shelfItem . Inner . Id ) ?? string . Empty ;
130+ if ( ! _watchers . TryGetValue ( parentPath , out var reference ) )
131+ return ;
132132
133133 // Decrease the reference count and remove the watcher if no references are present
134134 reference . ReferenceCount -= 1 ;
@@ -139,8 +139,8 @@ private async void Items_CollectionChanged(object? sender, NotifyCollectionChang
139139 _watchers . Remove ( parentPath ) ;
140140 }
141141
142- break ;
143- }
142+ break ;
143+ }
144144 }
145145 }
146146
@@ -152,16 +152,16 @@ private async void Watcher_CollectionChanged(object? sender, NotifyCollectionCha
152152 switch ( e . Action )
153153 {
154154 case NotifyCollectionChangedAction . Remove when e . OldItems is not null :
155- {
156- // Remove the matching item notified from the watcher
157- var item = e . OldItems . Cast < IStorable > ( ) . ElementAt ( 0 ) ;
158- var itemToRemove = Items . FirstOrDefault ( x => x . Inner . Id == item . Id ) ;
159- if ( itemToRemove is null )
160- return ;
161-
162- await MainWindow . Instance . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) => Items . Remove ( itemToRemove ) ) ;
163- break ;
164- }
155+ {
156+ // Remove the matching item notified from the watcher
157+ var item = e . OldItems . Cast < IStorable > ( ) . ElementAt ( 0 ) ;
158+ var itemToRemove = Items . FirstOrDefault ( x => x . Inner . Id == item . Id ) ;
159+ if ( itemToRemove is null )
160+ return ;
161+
162+ await MainWindow . Instance . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) => Items . Remove ( itemToRemove ) ) ;
163+ break ;
164+ }
165165 }
166166 }
167167 }
0 commit comments