Skip to content

Commit 5aebbc7

Browse files
committed
Finalize and Enable Up Navigation
1 parent f6c5f4d commit 5aebbc7

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

Files UWP/FilesUWP.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
<Version>5.1.0</Version>
293293
</PackageReference>
294294
<PackageReference Include="Microsoft.UI.Xaml">
295-
<Version>2.1.190405004.2</Version>
295+
<Version>2.1.190606001</Version>
296296
</PackageReference>
297297
</ItemGroup>
298298
<ItemGroup>

Files UWP/ProHome.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@
726726
</Button.KeyboardAccelerators>
727727
</Button>
728728

729-
<Button Visibility="Collapsed" Style="{StaticResource NavigationButtonNormalStyle}" x:Name="Up">
729+
<Button Visibility="Visible" Style="{StaticResource NavigationButtonNormalStyle}" x:Name="Up">
730730
<Button.Content>
731731
&#xE74A;
732732
</Button.Content>

Files UWP/ProHome.xaml.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,18 @@ public static void Up_Click(object sender, RoutedEventArgs e)
14801480
{
14811481
var instance = (instanceContentFrame.Content as GenericFileBrowser).instanceViewModel;
14821482
instance.CancelLoadAndClearFiles();
1483-
var parentDirectoryOfPath = instance.Universal.path.Remove(instance.Universal.path.LastIndexOf("\\"));
1484-
1483+
string parentDirectoryOfPath = null;
1484+
// Check that there isn't a slash at the end
1485+
if((instance.Universal.path.Count() - 1) - instance.Universal.path.LastIndexOf("\\") > 0)
1486+
{
1487+
parentDirectoryOfPath = instance.Universal.path.Remove(instance.Universal.path.LastIndexOf("\\"));
1488+
}
1489+
else // Slash found at end
1490+
{
1491+
var currentPathWithoutEndingSlash = instance.Universal.path.Remove(instance.Universal.path.LastIndexOf("\\"));
1492+
parentDirectoryOfPath = currentPathWithoutEndingSlash.Remove(currentPathWithoutEndingSlash.LastIndexOf("\\"));
1493+
}
1494+
14851495
var CurrentTabInstance = ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>();
14861496
if (parentDirectoryOfPath == ProHome.DesktopPath)
14871497
{
@@ -1547,7 +1557,17 @@ public static void Up_Click(object sender, RoutedEventArgs e)
15471557
{
15481558
var instance = (instanceContentFrame.Content as PhotoAlbum).instanceViewModel;
15491559
instance.CancelLoadAndClearFiles();
1550-
var parentDirectoryOfPath = instance.Universal.path.Remove(instance.Universal.path.LastIndexOf("\\"));
1560+
string parentDirectoryOfPath = null;
1561+
// Check that there isn't a slash at the end
1562+
if ((instance.Universal.path.Count() - 1) - instance.Universal.path.LastIndexOf("\\") > 0)
1563+
{
1564+
parentDirectoryOfPath = instance.Universal.path.Remove(instance.Universal.path.LastIndexOf("\\"));
1565+
}
1566+
else // Slash found at end
1567+
{
1568+
var currentPathWithoutEndingSlash = instance.Universal.path.Remove(instance.Universal.path.LastIndexOf("\\"));
1569+
parentDirectoryOfPath = currentPathWithoutEndingSlash.Remove(currentPathWithoutEndingSlash.LastIndexOf("\\"));
1570+
}
15511571

15521572
var CurrentTabInstance = ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>();
15531573
if (parentDirectoryOfPath == ProHome.DesktopPath)

0 commit comments

Comments
 (0)