@@ -118,47 +118,47 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
118
118
{
119
119
case "Start" :
120
120
ItemDisplayFrame . Navigate ( typeof ( YourHome ) , NavParams , new SuppressNavigationTransitionInfo ( ) ) ;
121
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems [ 0 ] ;
121
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( ) ;
122
122
break ;
123
123
124
124
case "Desktop" :
125
125
NavigationPath = AppSettings . DesktopPath ;
126
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . DesktopPath , StringComparison . OrdinalIgnoreCase ) ) ;
126
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . DesktopPath , StringComparison . OrdinalIgnoreCase ) ) ;
127
127
break ;
128
128
129
129
case "Downloads" :
130
130
NavigationPath = AppSettings . DownloadsPath ;
131
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . DownloadsPath , StringComparison . OrdinalIgnoreCase ) ) ;
131
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . DownloadsPath , StringComparison . OrdinalIgnoreCase ) ) ;
132
132
break ;
133
133
134
134
case "Documents" :
135
135
NavigationPath = AppSettings . DocumentsPath ;
136
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . DocumentsPath , StringComparison . OrdinalIgnoreCase ) ) ;
136
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . DocumentsPath , StringComparison . OrdinalIgnoreCase ) ) ;
137
137
break ;
138
138
139
139
case "Pictures" :
140
140
NavigationPath = AppSettings . PicturesPath ;
141
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . PicturesPath , StringComparison . OrdinalIgnoreCase ) ) ;
141
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . PicturesPath , StringComparison . OrdinalIgnoreCase ) ) ;
142
142
break ;
143
143
144
144
case "Music" :
145
145
NavigationPath = AppSettings . MusicPath ;
146
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . MusicPath , StringComparison . OrdinalIgnoreCase ) ) ;
146
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . MusicPath , StringComparison . OrdinalIgnoreCase ) ) ;
147
147
break ;
148
148
149
149
case "Videos" :
150
150
NavigationPath = AppSettings . VideosPath ;
151
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . VideosPath , StringComparison . OrdinalIgnoreCase ) ) ;
151
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . VideosPath , StringComparison . OrdinalIgnoreCase ) ) ;
152
152
break ;
153
153
154
154
case "RecycleBin" :
155
155
NavigationPath = AppSettings . RecycleBinPath ;
156
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . RecycleBinPath , StringComparison . OrdinalIgnoreCase ) ) ;
156
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . RecycleBinPath , StringComparison . OrdinalIgnoreCase ) ) ;
157
157
break ;
158
158
159
159
case "OneDrive" :
160
160
NavigationPath = AppSettings . OneDrivePath ;
161
- SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . First ( x => x . Path . Equals ( AppSettings . OneDrivePath , StringComparison . OrdinalIgnoreCase ) ) ;
161
+ SidebarControl . SelectedSidebarItem = MainPage . sideBarItems . FirstOrDefault ( x => x . Path . Equals ( AppSettings . OneDrivePath , StringComparison . OrdinalIgnoreCase ) ) ;
162
162
break ;
163
163
164
164
default :
@@ -171,12 +171,12 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
171
171
&& NavParams [ 1 ] == ':' )
172
172
{
173
173
NavigationPath = NavParams ;
174
- SidebarControl . SelectedSidebarItem = AppSettings . DrivesManager . Drives . First ( x => x . Path . ToString ( ) . Equals ( $ "{ NavParams [ 0 ] } :\\ ", StringComparison . OrdinalIgnoreCase ) ) ;
174
+ SidebarControl . SelectedSidebarItem = AppSettings . DrivesManager . Drives . FirstOrDefault ( x => x . Path . ToString ( ) . Equals ( $ "{ NavParams [ 0 ] } :\\ ", StringComparison . OrdinalIgnoreCase ) ) ;
175
175
}
176
176
else if ( NavParams . StartsWith ( "\\ \\ ?\\ " ) )
177
177
{
178
178
NavigationPath = NavParams ;
179
- SidebarControl . SelectedSidebarItem = App . AppSettings . DrivesManager . Drives . First ( x => x . Path . ToString ( ) . Equals ( $ "{ System . IO . Path . GetPathRoot ( NavParams ) } ", StringComparison . OrdinalIgnoreCase ) ) ;
179
+ SidebarControl . SelectedSidebarItem = App . AppSettings . DrivesManager . Drives . FirstOrDefault ( x => x . Path . ToString ( ) . Equals ( $ "{ System . IO . Path . GetPathRoot ( NavParams ) } ", StringComparison . OrdinalIgnoreCase ) ) ;
180
180
}
181
181
else if ( NavParams . StartsWith ( AppSettings . RecycleBinPath ) )
182
182
{
0 commit comments