@@ -326,148 +326,7 @@ private void NameDialog_SecondaryButtonClick(ContentDialog sender, ContentDialog
326326
327327 private async void VisiblePath_TextChanged ( object sender , KeyRoutedEventArgs e )
328328 {
329- if ( e . Key == VirtualKey . Enter )
330- {
331- var PathBox = ( sender as TextBox ) ;
332- var CurrentInput = PathBox . Text ;
333- if ( CurrentInput != App . ViewModel . Universal . path )
334- {
335- App . ViewModel . CancelLoadAndClearFiles ( ) ;
336-
337- if ( CurrentInput == "Home" || CurrentInput == "home" )
338- {
339- MainPage . accessibleContentFrame . Navigate ( typeof ( YourHome ) ) ;
340- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Recents" ;
341- }
342- else if ( CurrentInput == "Desktop" || CurrentInput == "desktop" )
343- {
344- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
345- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MainPage . DesktopPath ) ;
346- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Desktop" ;
347- App . PathText . Text = "Desktop" ;
348- }
349- else if ( CurrentInput == "Documents" || CurrentInput == "documents" )
350- {
351- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
352- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MainPage . DocumentsPath ) ;
353- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Documents" ;
354- App . PathText . Text = "Documents" ;
355-
356- }
357- else if ( CurrentInput == "Downloads" || CurrentInput == "downloads" )
358- {
359- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
360- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MainPage . DownloadsPath ) ;
361- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Downloads" ;
362- App . PathText . Text = "Downloads" ;
363-
364- }
365- else if ( CurrentInput == "Pictures" || CurrentInput == "pictures" )
366- {
367- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
368- MainPage . accessibleContentFrame . Navigate ( typeof ( PhotoAlbum ) , MainPage . PicturesPath ) ;
369- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Pictures" ;
370- App . PathText . Text = "Pictures" ;
371- }
372- else if ( CurrentInput == "Music" || CurrentInput == "music" )
373- {
374- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
375- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MainPage . MusicPath ) ;
376- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Music" ;
377- App . PathText . Text = "Music" ;
378-
379- }
380- else if ( CurrentInput == "Videos" || CurrentInput == "videos" )
381- {
382- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
383- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MainPage . VideosPath ) ;
384- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search Videos" ;
385- App . PathText . Text = "Videos" ;
386-
387- }
388- else if ( CurrentInput == "OneDrive" || CurrentInput == "Onedrive" || CurrentInput == "onedrive" )
389- {
390- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
391- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MainPage . OneDrivePath ) ;
392- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search OneDrive" ;
393- App . PathText . Text = "OneDrive" ;
394-
395- }
396- else
397- {
398- if ( CurrentInput . Contains ( "." ) )
399- {
400- if ( CurrentInput . Contains ( ".exe" ) || CurrentInput . Contains ( ".EXE" ) )
401- {
402- if ( StorageFile . GetFileFromPathAsync ( CurrentInput ) != null )
403- {
404- await Interaction . LaunchExe ( CurrentInput ) ;
405- PathBox . Text = App . ViewModel . Universal . path ;
406- }
407- else
408- {
409- MessageDialog dialog = new MessageDialog ( "The path typed was not correct. Please try again." , "Invalid Path" ) ;
410- await dialog . ShowAsync ( ) ;
411- }
412- }
413- else if ( StorageFolder . GetFolderFromPathAsync ( CurrentInput ) != null )
414- {
415- await StorageFolder . GetFolderFromPathAsync ( CurrentInput ) ;
416- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
417- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , CurrentInput ) ;
418- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search" ;
419- }
420- else
421- {
422- try
423- {
424- await StorageFile . GetFileFromPathAsync ( CurrentInput ) ;
425- StorageFile file = await StorageFile . GetFileFromPathAsync ( CurrentInput ) ;
426- var options = new LauncherOptions
427- {
428- DisplayApplicationPicker = false
429-
430- } ;
431- await Launcher . LaunchFileAsync ( file , options ) ;
432- PathBox . Text = App . ViewModel . Universal . path ;
433- }
434- catch ( ArgumentException )
435- {
436- MessageDialog dialog = new MessageDialog ( "The path typed was not correct. Please try again." , "Invalid Path" ) ;
437- await dialog . ShowAsync ( ) ;
438- }
439- catch ( FileNotFoundException )
440- {
441- MessageDialog dialog = new MessageDialog ( "The path typed was not correct. Please try again." , "Invalid Path" ) ;
442- await dialog . ShowAsync ( ) ;
443- }
444- }
445- }
446- else
447- {
448- try
449- {
450- await StorageFolder . GetFolderFromPathAsync ( CurrentInput ) ;
451- App . ViewModel . TextState . isVisible = Visibility . Collapsed ;
452- MainPage . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , CurrentInput ) ;
453- MainPage . accessibleAutoSuggestBox . PlaceholderText = "Search" ;
454- }
455- catch ( ArgumentException )
456- {
457- MessageDialog dialog = new MessageDialog ( "The path typed was not correct. Please try again." , "Invalid Path" ) ;
458- await dialog . ShowAsync ( ) ;
459- }
460- catch ( FileNotFoundException )
461- {
462- MessageDialog dialog = new MessageDialog ( "The path typed was not correct. Please try again." , "Invalid Path" ) ;
463- await dialog . ShowAsync ( ) ;
464- }
465-
466- }
467-
468- }
469- }
470- }
329+
471330
472331 }
473332
0 commit comments