Skip to content

Commit a1eb4f8

Browse files
committed
Add consent prompt back to rapid item loading function
1 parent 82bb5ac commit a1eb4f8

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Files/Filesystem/ItemViewModel.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,30 @@ public async void RapidAddItemsToCollectionAsync(string path)
582582
ObservableCollection<PartialStorageItem> partialFolders = null;
583583
var fetchOperation = Task.Run(async () =>
584584
{
585-
_rootFolder = await StorageFolder.GetFolderFromPathAsync(path);
585+
try
586+
{
587+
_rootFolder = await StorageFolder.GetFolderFromPathAsync(path);
588+
}
589+
catch (UnauthorizedAccessException)
590+
{
591+
await App.consentDialog.ShowAsync();
592+
}
593+
catch (COMException e)
594+
{
595+
Frame rootContentFrame = Window.Current.Content as Frame;
596+
MessageDialog driveGone = new MessageDialog(e.Message, "Did you unplug this drive?");
597+
await driveGone.ShowAsync();
598+
isLoadingItems = false;
599+
return;
600+
}
601+
catch (FileNotFoundException)
602+
{
603+
Frame rootContentFrame = Window.Current.Content as Frame;
604+
MessageDialog folderGone = new MessageDialog("The folder you've navigated to was not found.", "Did you delete this folder?");
605+
await folderGone.ShowAsync();
606+
isLoadingItems = false;
607+
return;
608+
}
586609

587610
QueryOptions options = new QueryOptions();
588611
if (await _rootFolder.GetIndexedStateAsync() == IndexedState.FullyIndexed)

0 commit comments

Comments
 (0)