Skip to content

Commit 89821d3

Browse files
authored
Added option to unpin libraries from the sidebar (#951)
1 parent 4e16068 commit 89821d3

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

Files.Package/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
1010
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
1111
IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
12-
<Identity Name="FilesUWPDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.9.2.0" />
12+
<Identity Name="FilesUWPDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.10.0.0" />
1313
<Properties>
1414
<DisplayName>Files UWP - Dev</DisplayName>
1515
<PublisherDisplayName>Yair A</PublisherDisplayName>

Files/View Models/SettingsViewModel.cs

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using GalaSoft.MvvmLight;
77
using GalaSoft.MvvmLight.Command;
88
using Microsoft.AppCenter.Analytics;
9+
using Microsoft.Toolkit.Uwp.Helpers;
910
using Newtonsoft.Json;
1011
using System;
1112
using System.Collections.Generic;
@@ -79,12 +80,6 @@ private void PinSidebarLocationItems()
7980
private void AddDefaultLocations()
8081
{
8182
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarHome"), Glyph = "\uE737", IsDefaultLocation = true, Path = "Home" });
82-
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarDesktop"), Glyph = "\uE8FC", IsDefaultLocation = true, Path = DesktopPath });
83-
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarDownloads"), Glyph = "\uE896", IsDefaultLocation = true, Path = DownloadsPath });
84-
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarDocuments"), Glyph = "\uE8A5", IsDefaultLocation = true, Path = DocumentsPath });
85-
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarPictures"), Glyph = "\uEB9F", IsDefaultLocation = true, Path = PicturesPath });
86-
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarMusic"), Glyph = "\uEC4F", IsDefaultLocation = true, Path = MusicPath });
87-
App.sideBarItems.Add(new LocationItem { Text = ResourceController.GetTranslation("SidebarVideos"), Glyph = "\uE8B2", IsDefaultLocation = true, Path = VideosPath });
8883
}
8984

9085
public List<string> LinesToRemoveFromFile = new List<string>();
@@ -95,6 +90,20 @@ private async void PopulatePinnedSidebarItems()
9590
StorageFolder cacheFolder = ApplicationData.Current.LocalCacheFolder;
9691
ListFile = await cacheFolder.CreateFileAsync("PinnedItems.txt", CreationCollisionOption.OpenIfExists);
9792

93+
if (SystemInformation.IsFirstRun || SystemInformation.IsAppUpdated)
94+
{
95+
var ListFile1 = await cacheFolder.GetFileAsync("PinnedItems.txt");
96+
List<string> items = new List<string>();
97+
items.Add(DesktopPath);
98+
items.Add(DownloadsPath);
99+
items.Add(DocumentsPath);
100+
items.Add(PicturesPath);
101+
items.Add(MusicPath);
102+
items.Add(VideosPath);
103+
104+
await FileIO.AppendLinesAsync(ListFile1, items);
105+
}
106+
98107
if (ListFile != null)
99108
{
100109
var ListFileLines = await FileIO.ReadLinesAsync(ListFile);
@@ -107,6 +116,31 @@ private async void PopulatePinnedSidebarItems()
107116
var content = name;
108117
var icon = "\uE8B7";
109118

119+
if (locationPath == DesktopPath)
120+
{
121+
icon = "\uE8FC";
122+
}
123+
else if (locationPath == DownloadsPath)
124+
{
125+
icon = "\uE896";
126+
}
127+
else if (locationPath == DocumentsPath)
128+
{
129+
icon = "\uE8A5";
130+
}
131+
else if (locationPath == PicturesPath)
132+
{
133+
icon = "\uEB9F";
134+
}
135+
else if (locationPath == MusicPath)
136+
{
137+
icon = "\uEC4F";
138+
}
139+
else if (locationPath == VideosPath)
140+
{
141+
icon = "\uE8B2";
142+
}
143+
110144
bool isDuplicate = false;
111145
foreach (INavigationControlItem sbi in App.sideBarItems)
112146
{

0 commit comments

Comments
 (0)