Skip to content

Commit 4de1932

Browse files
author
Yair Aichenbaum
committed
Merge branch 'develop' of https://github.com/duke7553/files-uwp into develop
2 parents 1c741a0 + 80519d0 commit 4de1932

File tree

3 files changed

+59
-17
lines changed

3 files changed

+59
-17
lines changed

Files/Filesystem/ItemViewModel.cs

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -545,29 +545,57 @@ public async void LoadExtendedItemProperties(ListedItem item)
545545
{
546546
BitmapImage icon = new BitmapImage();
547547
var matchingItem = _filesAndFolders.FirstOrDefault(x => x == item);
548-
var matchingStorageItem = await StorageFile.GetFileFromPathAsync(item.FilePath);
549-
if (matchingItem != null && matchingStorageItem != null)
548+
try
550549
{
551-
matchingItem.FileType = matchingStorageItem.DisplayType;
552-
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
553-
var Thumbnail = await matchingStorageItem.GetThumbnailAsync(ThumbnailMode.ListView, 20, ThumbnailOptions.UseCurrentScale);
554-
if (Thumbnail != null)
550+
var matchingStorageItem = await StorageFile.GetFileFromPathAsync(item.FilePath);
551+
if (matchingItem != null && matchingStorageItem != null)
555552
{
556-
matchingItem.FileImg = icon;
557-
await icon.SetSourceAsync(Thumbnail);
558-
matchingItem.EmptyImgVis = Visibility.Collapsed;
559-
matchingItem.FileIconVis = Visibility.Visible;
553+
matchingItem.FileType = matchingStorageItem.DisplayType;
554+
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
555+
var Thumbnail = await matchingStorageItem.GetThumbnailAsync(ThumbnailMode.ListView, 20, ThumbnailOptions.UseCurrentScale);
556+
if (Thumbnail != null)
557+
{
558+
matchingItem.FileImg = icon;
559+
await icon.SetSourceAsync(Thumbnail);
560+
matchingItem.EmptyImgVis = Visibility.Collapsed;
561+
matchingItem.FileIconVis = Visibility.Visible;
562+
}
560563
}
561564
}
565+
catch (UnauthorizedAccessException)
566+
{
567+
await App.consentDialog.ShowAsync();
568+
return;
569+
}
570+
catch (FileNotFoundException)
571+
{
572+
item.ItemPropertiesInitialized = true;
573+
return;
574+
}
575+
562576
}
563577
else
564578
{
565579
var matchingItem = _filesAndFolders.FirstOrDefault(x => x == item);
566-
var matchingStorageItem = await StorageFolder.GetFolderFromPathAsync(item.FilePath);
567-
if (matchingItem != null && matchingStorageItem != null)
580+
try
568581
{
569-
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
582+
var matchingStorageItem = await StorageFolder.GetFolderFromPathAsync(item.FilePath);
583+
if (matchingItem != null && matchingStorageItem != null)
584+
{
585+
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
586+
}
570587
}
588+
catch (UnauthorizedAccessException)
589+
{
590+
await App.consentDialog.ShowAsync();
591+
return;
592+
}
593+
catch (FileNotFoundException)
594+
{
595+
item.ItemPropertiesInitialized = true;
596+
return;
597+
}
598+
571599
}
572600

573601
item.ItemPropertiesInitialized = true;
@@ -630,6 +658,7 @@ public async void RapidAddItemsToCollectionAsync(string path)
630658
catch (UnauthorizedAccessException)
631659
{
632660
await App.consentDialog.ShowAsync();
661+
return;
633662
}
634663
catch (COMException e)
635664
{

Files/UserControls/YourHome.xaml.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,25 @@ public async void PopulateRecentsList()
268268
Visibility ItemFolderImgVis;
269269
Visibility ItemEmptyImgVis;
270270
Visibility ItemFileIconVis;
271-
if (mostRecentlyUsed.Entries.Count == 0)
271+
bool IsRecentsListEmpty = true;
272+
foreach(var entry in mostRecentlyUsed.Entries)
273+
{
274+
var item = await mostRecentlyUsed.GetItemAsync(entry.Token);
275+
if (item.IsOfType(StorageItemTypes.File))
276+
{
277+
IsRecentsListEmpty = false;
278+
}
279+
}
280+
281+
if (IsRecentsListEmpty)
272282
{
273283
Empty.Visibility = Visibility.Visible;
274284
}
275285
else
276286
{
277287
Empty.Visibility = Visibility.Collapsed;
278288
}
289+
279290
foreach (Windows.Storage.AccessCache.AccessListEntry entry in mostRecentlyUsed.Entries)
280291
{
281292
string mruToken = entry.Token;
@@ -313,6 +324,11 @@ public async void PopulateRecentsList()
313324
// Skip item until consent is provided
314325
}
315326
}
327+
328+
if(recentItemsCollection.Count == 0)
329+
{
330+
Empty.Visibility = Visibility.Visible;
331+
}
316332
}
317333

318334
private async void RecentsView_ItemClick(object sender, ItemClickEventArgs e)

Files/Views/Pages/ProHome.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,6 @@ private async void ProHomeInstance_KeyUp(object sender, KeyRoutedEventArgs e)
313313
case (false, false, false, true, VirtualKey.Delete): //delete, delete item
314314
App.CurrentInstance.InteractionOperations.DeleteItem_Click(null, null);
315315
break;
316-
case (false, false, false, true, VirtualKey.Enter): //enter, open item
317-
App.CurrentInstance.InteractionOperations.List_ItemClick(null, null);
318-
break;
319316
case (false, false, false, true, VirtualKey.Space): //space, quick look
320317
if ((App.CurrentInstance.ContentPage).IsQuickLookEnabled)
321318
{

0 commit comments

Comments
 (0)