6
6
using GalaSoft . MvvmLight ;
7
7
using GalaSoft . MvvmLight . Command ;
8
8
using Microsoft . AppCenter . Analytics ;
9
+ using Microsoft . Toolkit . Uwp . Helpers ;
9
10
using Newtonsoft . Json ;
10
11
using System ;
11
12
using System . Collections . Generic ;
@@ -79,12 +80,6 @@ private void PinSidebarLocationItems()
79
80
private void AddDefaultLocations ( )
80
81
{
81
82
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 } ) ;
88
83
}
89
84
90
85
public List < string > LinesToRemoveFromFile = new List < string > ( ) ;
@@ -95,6 +90,20 @@ private async void PopulatePinnedSidebarItems()
95
90
StorageFolder cacheFolder = ApplicationData . Current . LocalCacheFolder ;
96
91
ListFile = await cacheFolder . CreateFileAsync ( "PinnedItems.txt" , CreationCollisionOption . OpenIfExists ) ;
97
92
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
+
98
107
if ( ListFile != null )
99
108
{
100
109
var ListFileLines = await FileIO . ReadLinesAsync ( ListFile ) ;
@@ -107,6 +116,31 @@ private async void PopulatePinnedSidebarItems()
107
116
var content = name ;
108
117
var icon = "\uE8B7 " ;
109
118
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
+
110
144
bool isDuplicate = false ;
111
145
foreach ( INavigationControlItem sbi in App . sideBarItems )
112
146
{
0 commit comments