Exemplo n.º 1
0
        public FilteredTracks(LibraryFilter library, TrackDanceFilter filter, bool isDefault = false)
        {
            Library   = library;
            IsDefault = isDefault;
            Filter    = filter;
            Tracks.AddRange(Filter.Apply(LibraryTracks));

            Filter.PropertyChanged          += FilterPropertyChangeHandler;
            Filter.Dances.CollectionChanged += (s, e) => Refresh();
            if (!IsDefault)
            {
                Library.DefaultFilter.PropertyChanged += FilterOrTrackChangeHandler;
            }
        }
Exemplo n.º 2
0
        public FilteredTracks AddFilter(TrackDanceFilter filter)
        {
            if (string.IsNullOrEmpty(filter.Name))
            {
                throw new ApplicationException("Filter name must be specified.");
            }

            var fi = new FilteredTracks(this, filter);

            _allFilters.Add(fi);
            if (!String.IsNullOrEmpty(fi.FilterGroup))
            {
                var fg = _filterGroups.SingleOrDefault((g) => g.Name.Equals(fi.FilterGroup, StringComparison.InvariantCultureIgnoreCase));
                if (fg == null)
                {
                    fg = new FilterGroup(fi.FilterGroup);
                    _filterGroups.Add(fg);
                }
                fg.Add(fi);
            }
            return(fi);
        }
Exemplo n.º 3
0
 public LibraryFilter(Library library, TrackDanceFilter defaultFilter = null)
 {
     Library       = library;
     DefaultFilter = new FilteredTracks(this, defaultFilter ?? new TrackDanceFilter(), true);
     FilterGroups  = new ReadOnlyObservableCollection <FilterGroup>(_filterGroups);
 }