Ver código fonte

fix windows mounted listener.

Dan Walmsley 6 anos atrás
pai
commit
734b9f39b3

+ 4 - 5
src/Windows/Avalonia.Win32/WindowsMountedVolumeInfoListener.cs

@@ -10,8 +10,7 @@ namespace Avalonia.Win32
 {
     internal class WindowsMountedVolumeInfoListener : IDisposable
     {
-        private readonly CompositeDisposable _disposables;
-        private readonly ObservableCollection<MountedVolumeInfo> _targetObs = new ObservableCollection<MountedVolumeInfo>();
+        private readonly CompositeDisposable _disposables;        
         private bool _beenDisposed = false;
         private ObservableCollection<MountedVolumeInfo> mountedDrives;
 
@@ -41,14 +40,14 @@ namespace Avalonia.Win32
                                 })
                                 .ToArray();
 
-            if (_targetObs.SequenceEqual(mountVolInfos))
+            if (mountedDrives.SequenceEqual(mountVolInfos))
                 return;
             else
             {
-                _targetObs.Clear();
+                mountedDrives.Clear();
 
                 foreach (var i in mountVolInfos)
-                    _targetObs.Add(i);
+                    mountedDrives.Add(i);
             }
         }