private void changeFolder_Button_click(object sender, RoutedEventArgs e) { FolderBrowserDialog browser = new FolderBrowserDialog(); DialogResult result = browser.ShowDialog(); if (result == DialogResult.OK) { string path = browser.SelectedPath; File.WriteAllText("folders.mus", path); (App.Current as App).player.Close(); (App.Current as App).initializer(); DatabaseBuilder D = new DatabaseBuilder(path); Task t = Task.Factory.StartNew(() => D.createDatabase()) .ContinueWith(ignore => loadArtists()) .ContinueWith(ignore => loadAlbums()) .ContinueWith(ignore => loadGenre()) .ContinueWith(ignore => loadSongs()) .ContinueWith(ignore => { int a = 5; }); //t.Wait(); } }
private void Page_load(object sender, RoutedEventArgs e) { if (App.Current.Properties["startupFiles"] != null) { nowPlaying_Page page = new nowPlaying_Page(true); NavigationService.Navigate(page); App.Current.Properties["startupFiles"] = null; } else if (!File.Exists("database.db")) { Task t = Task.Factory.StartNew(() => d.createDatabase()) .ContinueWith(ignore => loadArtists()) .ContinueWith(ignore => loadSongs()) .ContinueWith(ignore => loadGenre()) .ContinueWith(ignore => loadAlbums()); } else { loadArtists(); loadSongs(); loadGenre(); loadAlbums(); } }