public void Load() { var song = Itemsource.SongLibrary; if (Settings.Default.MusicDirectory != "") // Check if music directory is empty { _songCount = Itemsource.LoadSongs(Settings.Default.MusicDirectory); SongGrid.ItemsSource = Itemsource.SongLibrary; SongGrid.Items.Refresh(); NoLoadLabel.Visibility = Visibility.Collapsed; } else // Empty setting load nothing (saves a load error) { NoLoadLabel.Visibility = Visibility.Visible; SongGrid.ItemsSource = null; } // Get the color they had ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(Settings.Default.PlayerColor), ThemeManager.GetAppTheme("BaseDark")); Colors.SelectedValue = Settings.Default.PlayerColor; // Color setting set to color (dictionaries.s) Directory1Text.Text = Settings.Default.MusicDirectory; // Music directory set to music directory (or empty string) var albums = song.GroupBy(x => x.Album).Select(x => x.First()).ToList(); var artists = Itemsource.SongLibrary.GroupBy(x => x.Artist).Select(x => x.First()).ToList(); foreach (var item in albums) { _albumCount++; } foreach (var item in artists) { _artistCount++; } Console.WriteLine("Loaded " + _albumCount + " albums from " + _artistCount + " artists"); }
private void SearchBox_TextChanged(object sender, System.Windows.Input.KeyEventArgs e) { bool textDeleted = false; var filterTextBox = (TextBox)sender; var filterText = filterTextBox.Text; if (e.Key == Key.Delete || e.Key == Key.Back) { textDeleted = true; } Itemsource.SetRowVisibilityByFilterText(filterText, SongGrid, textDeleted); }