public ObservableCollection <ISong> GetFilteredTrackCollection() { // merge in mixableRange tempo so we get the track tempo as a double rather than the tempo slider value as a int, for when getting next var slowestTempoSliderValue = Math.Round(Convert.ToDouble(TempoSliderValue), 3); var fastestTempoSliderValue = Math.Round(Convert.ToDouble(TempoSliderValue + 1), 3); // refactor ito Range project var tempoRangeValue = GetTempoRangeValue(); var slowestTempoSliderRangeValue = Math.Round((slowestTempoSliderValue - tempoRangeValue), 3); var fastestTempoSliderRangeValue = Math.Round((fastestTempoSliderValue + tempoRangeValue), 3); _harmonicKeyRange.Load(SelectedHarmonicKeyComboBoxItem); _trackSearch.Reset(); _trackSearch.Text = SearchTextBoxText; _trackSearch.Load(); var selectedPlaylists = PlaylistCollection.Where(p => p.Selected); return(new ObservableCollection <ISong>(ImportedTrackCollection.Where(t => // not in preparation list (!PreparationCollection.Contains(t) // and playlist is selected && (selectedPlaylists.FirstOrDefault(p => p.Path == Path.GetDirectoryName(t.Path)) != null) // and (exact filter match && ((!IsMixableRangeCheckboxChecked && (TempoSliderValue == 0 || (Math.Round(t.LeadingTempo, 3) >= slowestTempoSliderValue && Math.Round(t.LeadingTempo, 3) <= fastestTempoSliderValue)) && (string.IsNullOrEmpty(SelectedHarmonicKeyComboBoxItem) || t.LeadingHarmonicKey == SelectedHarmonicKeyComboBoxItem)) // or mixable range filter match) || (IsMixableRangeCheckboxChecked && ((TempoSliderValue == 0 || (Math.Round(t.LeadingTempo, 3) >= slowestTempoSliderRangeValue && Math.Round(t.LeadingTempo, 3) <= fastestTempoSliderRangeValue)) && ((string.IsNullOrEmpty(SelectedHarmonicKeyComboBoxItem) || (t.LeadingHarmonicKey == _harmonicKeyRange.InnerCircleHarmonicKey || t.LeadingHarmonicKey == _harmonicKeyRange.OuterCircleHarmonicKey || t.LeadingHarmonicKey == _harmonicKeyRange.PlusOneHarmonicKey || t.LeadingHarmonicKey == _harmonicKeyRange.MinusOneHarmonicKey)))))) // and matches playlist && (string.IsNullOrEmpty(SelectedPlaylistComboBoxItem) || t.Playlist == SelectedPlaylistComboBoxItem) // and matches search text && (string.IsNullOrEmpty(_trackSearch.Text) || t.Artist.ToLower().Contains(_trackSearch.Text.ToLower().Trim()) || t.Title.ToLower().Contains(_trackSearch.Text.ToLower().Trim())) || (!string.IsNullOrEmpty(_trackSearch.Artist) && !string.IsNullOrEmpty(_trackSearch.Title) && ((t.Artist.ToLower().Contains(_trackSearch.Artist.ToLower()) && t.Title.ToLower().Contains(_trackSearch.Title.ToLower())) || (t.Artist.ToLower().Contains(_trackSearch.Title.ToLower()) && t.Title.ToLower().Contains(_trackSearch.Artist.ToLower())))) )))); }
internal void ClearPlaylists() { FilteredTrackCollection.Clear(); ImportedTrackCollection.Clear(); PreparationCollection.Clear(); MixDiscCollection.Clear(); ClearFilter(); ClearMixDiscFilter(); _mixDiscTracks = new List <List <ISong> >(); EnableControls(); EnableMixDiscControls(); ProgressBarMessage = "Ready to import"; }
internal void OnDeleteButtonCommand(object param) { if (SelectedPreparationItem != null) { var fullNameText = SelectedPreparationItem.FullNameText; PreparationCollection.Remove(SelectedPreparationItem); var preparationCollectionCount = PreparationCollection.Count(); if (preparationCollectionCount > 0) { SelectedPreparationItem = PreparationCollection[preparationCollectionCount - 1]; } EnableControls(); ProgressBarMessage = string.Concat("Deleted ", fullNameText); } else { MessageBox.Show("No track selected to delete."); } }
internal void OnLoadButtonCommand(object param) { if (SelectedTrackCollectionItem != null) { if (SelectedPreparationItem != null) { var index = PreparationCollection.IndexOf(SelectedPreparationItem); PreparationCollection.Insert(index + 1, SelectedTrackCollectionItem); } else { PreparationCollection.Add(SelectedTrackCollectionItem); } EnableControls(); ProgressBarMessage = string.Concat("Loaded ", SelectedTrackCollectionItem.FullNameText); SelectedPreparationItem = SelectedTrackCollectionItem; SelectedTabControlIndex = PreparationTabControlIndex; } else { MessageBox.Show("No track selected to load."); } }