Skip to content

Commit f4e8d80

Browse files
yaira2lukeblevinsR3voA3creeperlvpiotrulos
authored
v0.7.2 (#471)
* Implement Win32 FileTimeToSystemTime * Handle/log exception during device StorageFolder initialization step * Prevent Pinning OneDrive Multiple Times * Add files via upload * Update Files.Package.wapproj * Copy assets * Update azure-pipelines.yml * Update azure-pipelines.yml * Update azure-pipelines.yml * Cleaned up assets Fixed null crash in SettingsViewModel * Revert * Add Property for Hiding File Extensions * Fixed crash on first launch * Added confirm delete ui * Added InteractionViewModel * Refactored PermanentlyDelete shortcut * Hooked up confirm to delete dialog * Fixed focus state on confirm to delete dialog * Added strings * Fixed focus issue for confirm delete dialog * Added a setting to turn off the delete confirmation dialog * Fixed delete item shortcut * Removed blank line * Refactored Sidebar.xaml.cs * Implement Hidden File Extensions Setting * Update Files.de-DE.xlf (#457) - Updated the translation - Fixed some typos in old strings * Fixed the problem of Settings page when in non-English environment. (#460) * Added buttons to the set custom location text boxes * Added the option to browse for setting custom folder loacations * Fixed bug with nav menu * Toned down reveal affect for the navigation menu * Correct an issue with getting file path for setting the desktop wallpaper * Setting the wallpaper photo now works * Refactored variable name * Updated nuget packages * Only show SetDesktopBackground on image files * Finished basic work on setting the desktop background * Fixed typo * Fixed bug with setting desktop wallpaper * Added a comment * Delete temp file when finished working with it * Revert last commit * Update Files.pl-PL.xlf (#463) Updated translation (#37) * Improve General Behavior of Sidebar * Add WinUI ItemsRepeater Workaround for Sidebar * Temporary fix for settings * Remove friendly names for locations * Simplify Pathbar Logic * Prevent crash on home navigation * Replace Start with New tab * Added strings for items in the sidebar * Update Files.de-DE.xlf (#469) Updated translation * Update azure-pipelines.yml for Azure Pipelines * Only update drives collection from UI Thread * Exclude extended item properties if generic Exception is caught * Fix crash on right click of pinned sidebar item * Increased version number * Fix bug with crash on copy path * Fix Photo Layout display Co-authored-by: Luke Blevins <[email protected]> Co-authored-by: R3voA3 <[email protected]> Co-authored-by: Creeper Lv <[email protected]> Co-authored-by: piotrulos <[email protected]>
1 parent 678feed commit f4e8d80

40 files changed

+1829
-1287
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="49306atecsolution.FilesUWP" Publisher="CN=Luke Blevins" Version="0.7.1.0" />
3+
<Identity Name="49306atecsolution.FilesUWP" Publisher="CN=Luke Blevins" Version="0.7.2.0" />
44
<Properties>
55
<DisplayName>Files UWP - Preview</DisplayName>
66
<PublisherDisplayName>Yair A</PublisherDisplayName>

Files/App.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static IShellPage CurrentInstance
5656
public static ObservableCollection<LocationItem> locationItems = new ObservableCollection<LocationItem>();
5757
public static ObservableCollection<WSLDistroItem> linuxDistroItems = new ObservableCollection<WSLDistroItem>();
5858
public static SettingsViewModel AppSettings { get; set; }
59+
public static InteractionViewModel InteractionViewModel { get; set; }
5960

6061
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
6162

@@ -81,6 +82,7 @@ public App()
8182
AppCenter.Start("682666d1-51d3-4e4a-93d0-d028d43baaa0", typeof(Analytics), typeof(Crashes));
8283

8384
AppSettings = new SettingsViewModel();
85+
InteractionViewModel = new InteractionViewModel();
8486
}
8587

8688
private void RegisterUncaughtExceptionLogger()

Files/BaseLayout.cs

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public abstract class BaseLayout : Page
3131
public ItemViewModel AssociatedViewModel = null;
3232
public Interaction AssociatedInteractions = null;
3333
public bool isRenamingItem = false;
34-
public List<ListedItem> SelectedItems
35-
{
34+
public List<ListedItem> SelectedItems
35+
{
3636
get
3737
{
3838
if (App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser))
@@ -99,7 +99,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
9999
(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.AlwaysPresentCommands.isEnabled = true;
100100
AssociatedViewModel.EmptyTextState.isVisible = Visibility.Collapsed;
101101
App.CurrentInstance.ViewModel.Universal.path = parameters;
102-
102+
103103
if (App.CurrentInstance.ViewModel.Universal.path == Path.GetPathRoot(App.CurrentInstance.ViewModel.Universal.path))
104104
{
105105
App.CurrentInstance.NavigationControl.CanNavigateToParent = false;
@@ -112,45 +112,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
112112
App.CurrentInstance.ViewModel.AddItemsToCollectionAsync(App.CurrentInstance.ViewModel.Universal.path);
113113
App.Clipboard_ContentChanged(null, null);
114114

115-
if (parameters.Equals(App.AppSettings.DesktopPath))
116-
{
117-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "Desktop";
118-
}
119-
else if (parameters.Equals(App.AppSettings.DocumentsPath))
120-
{
121-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "Documents";
122-
}
123-
else if (parameters.Equals(App.AppSettings.DownloadsPath))
124-
{
125-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "Downloads";
126-
}
127-
else if (parameters.Equals(App.AppSettings.PicturesPath))
128-
{
129-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "Pictures";
130-
}
131-
else if (parameters.Equals(App.AppSettings.MusicPath))
132-
{
133-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "Music";
134-
}
135-
else if (parameters.Equals(App.AppSettings.OneDrivePath))
136-
{
137-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "OneDrive";
138-
}
139-
else if (parameters.Equals(App.AppSettings.VideosPath))
140-
{
141-
App.CurrentInstance.NavigationControl.PathControlDisplayText = "Videos";
142-
}
143-
else
144-
{
145-
if (parameters.Equals(@"C:\") || parameters.Equals(@"c:\"))
146-
{
147-
App.CurrentInstance.NavigationControl.PathControlDisplayText = @"Local Disk (C:\)";
148-
}
149-
else
150-
{
151-
App.CurrentInstance.NavigationControl.PathControlDisplayText = parameters;
152-
}
153-
}
115+
App.CurrentInstance.NavigationControl.PathControlDisplayText = parameters;
154116
}
155117

156118
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
@@ -220,6 +182,9 @@ public void RightClickContextMenu_Opening(object sender, object e)
220182
}
221183

222184
}
185+
186+
//check if the selected file is an image
187+
App.InteractionViewModel.CheckForImage();
223188
}
224189

225190

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<ContentDialog
2+
x:Class="Files.Dialogs.ConfirmDeleteDialog"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="using:Files.Dialogs"
8+
xmlns:local1="using:Files"
9+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
10+
x:Uid="ConfirmDeleteDialog"
11+
Title="Delete Item(s)"
12+
CornerRadius="4"
13+
mc:Ignorable="d">
14+
15+
<Grid>
16+
<TextBlock
17+
x:Uid="ConfirmDeleteDialogHeader"
18+
Text="Are you sure you want to delete the selected item(s)?"
19+
TextWrapping="WrapWholeWords" />
20+
21+
<CheckBox
22+
x:Name="chkPermanentlyDelete"
23+
x:Uid="ConfirmDeleteDialogPermanentlyDeleteCheckBox"
24+
Content="Permanently delete"
25+
IsChecked="{x:Bind local1:App.InteractionViewModel.PermanentlyDelete, Mode=TwoWay}" />
26+
27+
<StackPanel
28+
HorizontalAlignment="Right"
29+
VerticalAlignment="Bottom"
30+
Orientation="Horizontal"
31+
Spacing="10">
32+
33+
<Button
34+
x:Name="btnCancel"
35+
x:Uid="ConfirmDeleteDialogCancelButton"
36+
Click="btnCancel_Click"
37+
Content="Cancel" />
38+
39+
<Button
40+
x:Name="btnDelete" TabIndex="0"
41+
x:Uid="ConfirmDeleteDialogDeleteButton"
42+
Background="{ThemeResource SystemAccentColor}"
43+
Click="btnDelete_Click"
44+
Content="Delete" />
45+
46+
</StackPanel>
47+
48+
</Grid>
49+
</ContentDialog>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.Foundation;
7+
using Windows.Foundation.Collections;
8+
using Windows.System;
9+
using Windows.UI.Xaml;
10+
using Windows.UI.Xaml.Controls;
11+
using Windows.UI.Xaml.Controls.Primitives;
12+
using Windows.UI.Xaml.Data;
13+
using Windows.UI.Xaml.Input;
14+
using Windows.UI.Xaml.Media;
15+
using Windows.UI.Xaml.Navigation;
16+
17+
// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
18+
19+
namespace Files.Dialogs
20+
{
21+
public sealed partial class ConfirmDeleteDialog : ContentDialog
22+
{
23+
public MyResult Result { get; set; }
24+
public enum MyResult
25+
{
26+
Delete,
27+
Cancel,
28+
Nothing
29+
}
30+
31+
public ConfirmDeleteDialog()
32+
{
33+
this.InitializeComponent();
34+
35+
this.Result = MyResult.Nothing; //clear the result in case the value is set from last time
36+
}
37+
38+
private void btnDelete_Click(object sender, RoutedEventArgs e)
39+
{
40+
Result = MyResult.Delete;
41+
Hide();
42+
}
43+
44+
private void btnCancel_Click(object sender, RoutedEventArgs e)
45+
{
46+
Result = MyResult.Cancel;
47+
Hide();
48+
}
49+
}
50+
}

Files/Files.csproj

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@
146146
<Compile Include="CommandLine\ParsedCommand.cs" />
147147
<Compile Include="CommandLine\ParsedCommands.cs" />
148148
<Compile Include="CommandLine\ParsedCommandType.cs" />
149+
<Compile Include="Dialogs\ConfirmDeleteDialog.xaml.cs">
150+
<DependentUpon>ConfirmDeleteDialog.xaml</DependentUpon>
151+
</Compile>
149152
<Compile Include="UserControls\NavigationToolbar\INavigationToolbar.cs" />
150153
<Compile Include="UserControls\NavigationToolbar\NavigationToolbar.xaml.cs">
151154
<DependentUpon>NavigationToolbar.xaml</DependentUpon>
@@ -203,6 +206,7 @@
203206
<Compile Include="UserControls\GenericFileBrowser.xaml.cs">
204207
<DependentUpon>GenericFileBrowser.xaml</DependentUpon>
205208
</Compile>
209+
<Compile Include="View Models\InteractionViewModel.cs" />
206210
<Compile Include="Views\Layouts\InstanceTabsView.xaml.cs">
207211
<DependentUpon>InstanceTabsView.xaml</DependentUpon>
208212
</Compile>
@@ -309,6 +313,10 @@
309313
<Generator>MSBuild:Compile</Generator>
310314
<SubType>Designer</SubType>
311315
</ApplicationDefinition>
316+
<Page Include="Dialogs\ConfirmDeleteDialog.xaml">
317+
<Generator>MSBuild:Compile</Generator>
318+
<SubType>Designer</SubType>
319+
</Page>
312320
<Page Include="UserControls\NavigationToolbar\NavigationToolbar.xaml">
313321
<SubType>Designer</SubType>
314322
<Generator>MSBuild:Compile</Generator>
@@ -432,13 +440,13 @@
432440
</ItemGroup>
433441
<ItemGroup>
434442
<PackageReference Include="ByteSize">
435-
<Version>1.3.0</Version>
443+
<Version>2.0.0</Version>
436444
</PackageReference>
437445
<PackageReference Include="Microsoft.AppCenter.Analytics">
438-
<Version>2.6.4</Version>
446+
<Version>3.0.0</Version>
439447
</PackageReference>
440448
<PackageReference Include="Microsoft.AppCenter.Crashes">
441-
<Version>2.6.4</Version>
449+
<Version>3.0.0</Version>
442450
</PackageReference>
443451
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
444452
<Version>6.2.9</Version>
@@ -462,7 +470,7 @@
462470
<Version>6.0.0</Version>
463471
</PackageReference>
464472
<PackageReference Include="Microsoft.UI.Xaml">
465-
<Version>2.3.191211002</Version>
473+
<Version>2.4.0-prerelease.200203002</Version>
466474
</PackageReference>
467475
<PackageReference Include="Microsoft.Win32.Registry">
468476
<Version>4.7.0</Version>
@@ -474,10 +482,10 @@
474482
<Version>12.0.3</Version>
475483
</PackageReference>
476484
<PackageReference Include="NLog">
477-
<Version>4.6.8</Version>
485+
<Version>4.7.0-rc1</Version>
478486
</PackageReference>
479487
<PackageReference Include="NLog.Schema">
480-
<Version>4.6.8</Version>
488+
<Version>4.7.0-rc1</Version>
481489
</PackageReference>
482490
</ItemGroup>
483491
<ItemGroup>

Files/Filesystem/Drives.cs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,35 @@ public DrivesManager()
5353

5454
private async void DeviceWatcher_EnumerationCompleted(DeviceWatcher sender, object args)
5555
{
56-
if(App.sideBarItems.FirstOrDefault(x => x is HeaderTextItem && x.Text == "Drives") == null)
57-
{
58-
App.sideBarItems.Add(new HeaderTextItem() { Text = "Drives" });
59-
}
60-
foreach (DriveItem drive in Drives)
56+
// Only update collection from UI-thread
57+
try
6158
{
62-
if (!App.sideBarItems.Contains(drive))
59+
await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
6360
{
64-
App.sideBarItems.Add(drive);
65-
}
66-
}
61+
if (App.sideBarItems.FirstOrDefault(x => x is HeaderTextItem && x.Text == "Drives") == null)
62+
{
63+
App.sideBarItems.Add(new HeaderTextItem() { Text = "Drives" });
64+
}
65+
foreach (DriveItem drive in Drives)
66+
{
67+
if (!App.sideBarItems.Contains(drive))
68+
{
69+
App.sideBarItems.Add(drive);
70+
}
71+
}
6772

68-
foreach(INavigationControlItem item in App.sideBarItems.ToList())
73+
foreach (INavigationControlItem item in App.sideBarItems.ToList())
74+
{
75+
if (item is DriveItem && !Drives.Contains(item))
76+
{
77+
App.sideBarItems.Remove(item);
78+
}
79+
}
80+
});
81+
}
82+
catch (Exception)
6983
{
70-
if(item is DriveItem && !Drives.Contains(item))
71-
{
72-
App.sideBarItems.Remove(item);
73-
}
84+
// UI thread not created yet?
7485
}
7586
}
7687

Files/Filesystem/ItemViewModel.cs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -599,17 +599,11 @@ public async void LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
599599
}
600600
}
601601
}
602-
catch (UnauthorizedAccessException)
602+
catch (Exception)
603603
{
604604
item.ItemPropertiesInitialized = true;
605605
return;
606-
}
607-
catch (FileNotFoundException)
608-
{
609-
item.ItemPropertiesInitialized = true;
610-
return;
611-
}
612-
606+
}
613607
}
614608
else
615609
{
@@ -622,17 +616,11 @@ public async void LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
622616
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
623617
}
624618
}
625-
catch (UnauthorizedAccessException)
619+
catch (Exception)
626620
{
627621
item.ItemPropertiesInitialized = true;
628622
return;
629-
}
630-
catch (FileNotFoundException)
631-
{
632-
item.ItemPropertiesInitialized = true;
633-
return;
634-
}
635-
623+
}
636624
}
637625

638626
item.ItemPropertiesInitialized = true;
@@ -808,7 +796,14 @@ private void AddFolder(WIN32_FIND_DATA findData, string pathRoot)
808796

809797
private void AddFile(WIN32_FIND_DATA findData, string pathRoot)
810798
{
811-
var itemName = findData.cFileName;
799+
var itemPath = Path.Combine(pathRoot, findData.cFileName);
800+
801+
string itemName = null;
802+
if (App.AppSettings.ShowFileExtensions)
803+
itemName = findData.cFileName;
804+
else
805+
itemName = Path.GetFileNameWithoutExtension(itemPath);
806+
812807
FileTimeToSystemTime(ref findData.ftLastWriteTime, out SYSTEMTIME systemTimeOutput);
813808
var itemDate = new DateTime(
814809
systemTimeOutput.Year,
@@ -818,7 +813,6 @@ private void AddFile(WIN32_FIND_DATA findData, string pathRoot)
818813
systemTimeOutput.Minute,
819814
systemTimeOutput.Second,
820815
systemTimeOutput.Milliseconds);
821-
var itemPath = Path.Combine(pathRoot, findData.cFileName);
822816
var itemSize = ByteSize.FromBytes((findData.nFileSizeHigh << 32) + (long)(uint)findData.nFileSizeLow).ToString();
823817
var itemSizeBytes = (findData.nFileSizeHigh << 32) + (ulong)(uint)findData.nFileSizeLow;
824818
string itemType = "File";

0 commit comments

Comments
 (0)