Skip to content

Commit 9d8b6e8

Browse files
yaira2lukeblevinstsvietOK
authored
v0.8.2 (#807)
* Fix blurry thumbnails for some items in grid view (#790) * Switch ThumbnailMode to SingleItem for better thumbnails (#791) * Fixed crash when using keyboard shortcuts the home page (#802) * Optimized home page identifying (#804) * Defer adding drives to UI until MainView is activated (#806) * Update Package.appxmanifest Co-authored-by: Luke Blevins <[email protected]> Co-authored-by: Vladyslav <[email protected]>
1 parent d092f76 commit 9d8b6e8

File tree

8 files changed

+70
-29
lines changed

8 files changed

+70
-29
lines changed

Files.Package/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
3-
<Identity Name="FilesUWPDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.8.1.0" />
3+
<Identity Name="FilesUWPDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.8.2.0" />
44
<Properties>
55
<DisplayName>Files UWP - Dev</DisplayName>
66
<PublisherDisplayName>Yair A</PublisherDisplayName>

Files/BaseLayout.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
182182
{
183183
App.CurrentInstance.NavigationToolbar.CanNavigateToParent = true;
184184
}
185+
App.InteractionViewModel.IsPageTypeNotHome = true; // show controls that were hidden on the home page
185186

186187
await App.CurrentInstance.ViewModel.RefreshItems();
187188

Files/Filesystem/Drives.cs

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,63 @@ public DrivesManager()
5151
});
5252
}
5353

54-
private void DeviceWatcher_EnumerationCompleted(DeviceWatcher sender, object args)
54+
private async void DeviceWatcher_EnumerationCompleted(DeviceWatcher sender, object args)
5555
{
56-
if (App.sideBarItems.FirstOrDefault(x => x is HeaderTextItem && x.Text == ResourceController.GetTranslation("SidebarDrives")) == null)
56+
try
5757
{
58-
App.sideBarItems.Add(new HeaderTextItem() { Text = ResourceController.GetTranslation("SidebarDrives") });
58+
await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
59+
{
60+
if (App.sideBarItems.FirstOrDefault(x => x is HeaderTextItem && x.Text == ResourceController.GetTranslation("SidebarDrives")) == null)
61+
{
62+
App.sideBarItems.Add(new HeaderTextItem() { Text = ResourceController.GetTranslation("SidebarDrives") });
63+
}
64+
foreach (DriveItem drive in Drives)
65+
{
66+
if (!App.sideBarItems.Contains(drive))
67+
{
68+
App.sideBarItems.Add(drive);
69+
}
70+
}
71+
foreach (INavigationControlItem item in App.sideBarItems.ToList())
72+
{
73+
if (item is DriveItem && !Drives.Contains(item))
74+
{
75+
App.sideBarItems.Remove(item);
76+
}
77+
}
78+
});
5979
}
60-
foreach (DriveItem drive in Drives)
80+
catch (Exception) // UI Thread not ready yet, so we defer the pervious operation until it is.
6181
{
62-
if (!App.sideBarItems.Contains(drive))
63-
{
64-
App.sideBarItems.Add(drive);
65-
}
82+
// Defer because UI-thread is not ready yet (and DriveItem requires it?)
83+
CoreApplication.MainView.Activated += MainView_Activated;
6684
}
67-
foreach (INavigationControlItem item in App.sideBarItems.ToList())
85+
}
86+
87+
private async void MainView_Activated(CoreApplicationView sender, Windows.ApplicationModel.Activation.IActivatedEventArgs args)
88+
{
89+
await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
6890
{
69-
if (item is DriveItem && !Drives.Contains(item))
91+
if (App.sideBarItems.FirstOrDefault(x => x is HeaderTextItem && x.Text == ResourceController.GetTranslation("SidebarDrives")) == null)
7092
{
71-
App.sideBarItems.Remove(item);
93+
App.sideBarItems.Add(new HeaderTextItem() { Text = ResourceController.GetTranslation("SidebarDrives") });
7294
}
73-
}
95+
foreach (DriveItem drive in Drives)
96+
{
97+
if (!App.sideBarItems.Contains(drive))
98+
{
99+
App.sideBarItems.Add(drive);
100+
}
101+
}
102+
foreach (INavigationControlItem item in App.sideBarItems.ToList())
103+
{
104+
if (item is DriveItem && !Drives.Contains(item))
105+
{
106+
App.sideBarItems.Remove(item);
107+
}
108+
}
109+
});
110+
CoreApplication.MainView.Activated -= MainView_Activated;
74111
}
75112

76113
private async void DeviceAdded(DeviceWatcher sender, DeviceInformation args)

Files/UserControls/LayoutModes/GenericFileBrowser.xaml.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Windows.UI.Xaml.Controls;
2020
using Windows.UI.Xaml.Data;
2121
using Windows.UI.Xaml.Input;
22+
using Windows.UI.Xaml.Navigation;
2223

2324
namespace Files
2425
{
@@ -80,9 +81,19 @@ public GenericFileBrowser()
8081
break;
8182
}
8283

83-
App.CurrentInstance.ViewModel.PropertyChanged += ViewModel_PropertyChanged;
8484
App.AppSettings.ThemeModeChanged += AppSettings_ThemeModeChanged;
8585
}
86+
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
87+
{
88+
base.OnNavigatedTo(eventArgs);
89+
App.CurrentInstance.ViewModel.PropertyChanged += ViewModel_PropertyChanged;
90+
}
91+
92+
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
93+
{
94+
base.OnNavigatingFrom(e);
95+
App.CurrentInstance.ViewModel.PropertyChanged -= ViewModel_PropertyChanged;
96+
}
8697

8798
private void AppSettings_ThemeModeChanged(object sender, EventArgs e)
8899
{

Files/UserControls/ModernSidebar.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ private void Sidebar_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
117117
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), NavigationPath, new SuppressNavigationTransitionInfo());
118118
}
119119

120-
App.InteractionViewModel.IsPageTypeNotHome = true; // show controls that were hidden on the home page
121-
122120
App.CurrentInstance.NavigationToolbar.PathControlDisplayText = App.CurrentInstance.ViewModel.WorkingDirectory;
123121
}
124122

Files/UserControls/YourHome.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private void OpenFileLocation_Click(object sender, RoutedEventArgs e)
4444
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
4545
{
4646
base.OnNavigatedTo(eventArgs);
47+
App.InteractionViewModel.IsPageTypeNotHome = false;
4748
var parameters = eventArgs.Parameter.ToString();
4849
Locations.ItemLoader.itemsAdded.Clear();
4950
Locations.ItemLoader.DisplayItems();
@@ -127,8 +128,6 @@ private void Button_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEven
127128
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), NavigationPath); // Grid View
128129
break;
129130
}
130-
131-
App.InteractionViewModel.IsPageTypeNotHome = true; // show controls that were hidden on the home page
132131
}
133132

134133
public static StorageFile RecentsFile;

Files/View Models/ItemViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ public async void LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
593593
{
594594
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
595595
matchingItem.ItemType = matchingStorageItem.DisplayType;
596-
using (var Thumbnail = await matchingStorageItem.GetThumbnailAsync(ThumbnailMode.ListView, thumbnailSize, ThumbnailOptions.ReturnOnlyIfCached))
596+
using (var Thumbnail = await matchingStorageItem.GetThumbnailAsync(ThumbnailMode.SingleItem, thumbnailSize, ThumbnailOptions.ReturnOnlyIfCached))
597597
{
598598
if (Thumbnail != null)
599599
{

Files/Views/Pages/ModernShellPage.xaml.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ private void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e)
168168
{
169169
if (ItemDisplayFrame.CurrentSourcePageType == typeof(GenericFileBrowser))
170170
{
171-
App.InteractionViewModel.IsPageTypeNotHome = true;
172171
// Reset DataGrid Rows that may be in "cut" command mode
173172
IEnumerable items = (ItemDisplayFrame.Content as GenericFileBrowser).AllView.ItemsSource;
174173
if (items == null)
@@ -182,7 +181,6 @@ private void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e)
182181
}
183182
else if (App.CurrentInstance.CurrentPageType == typeof(PhotoAlbum))
184183
{
185-
App.InteractionViewModel.IsPageTypeNotHome = true;
186184
// Reset Photo Grid items that may be in "cut" command mode
187185
foreach (ListedItem listedItem in (ItemDisplayFrame.Content as PhotoAlbum).FileList.Items)
188186
{
@@ -195,10 +193,6 @@ private void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e)
195193
imageOfItem.Opacity = 1;
196194
}
197195
}
198-
else if (App.CurrentInstance.CurrentPageType == typeof(YourHome))
199-
{
200-
App.InteractionViewModel.IsPageTypeNotHome = false;
201-
}
202196
}
203197

204198
public void UpdateProgressFlyout(InteractionOperationType operationType, int amountComplete, int amountTotal)
@@ -231,7 +225,8 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
231225
var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
232226
var alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);
233227
var shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
234-
var tabInstance = App.CurrentInstance != null;
228+
var tabInstance = App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser)
229+
|| App.CurrentInstance.CurrentPageType == typeof(PhotoAlbum);
235230

236231
switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: e.Key)
237232
{
@@ -265,15 +260,15 @@ private async void ModernShellPage_KeyUp(object sender, KeyRoutedEventArgs e)
265260
App.CurrentInstance.InteractionOperations.SelectAllItems();
266261
break;
267262

268-
case (true, false, false, true, VirtualKey.N): //ctrl + n, new window
263+
case (true, false, false, false, VirtualKey.N): //ctrl + n, new window
269264
App.CurrentInstance.InteractionOperations.LaunchNewWindow();
270265
break;
271266

272-
case (true, false, false, true, VirtualKey.W): //ctrl + w, close tab
267+
case (true, false, false, false, VirtualKey.W): //ctrl + w, close tab
273268
App.CurrentInstance.InteractionOperations.CloseTab();
274269
break;
275270

276-
case (true, false, false, true, VirtualKey.F4): //ctrl + F4, close tab
271+
case (true, false, false, false, VirtualKey.F4): //ctrl + F4, close tab
277272
App.CurrentInstance.InteractionOperations.CloseTab();
278273
break;
279274

0 commit comments

Comments
 (0)