public void MoveTrack(int dropIndex, string trackName)
        {
            if (dropIndex < 0 && dropIndex >= _trackCollection.Count)
            {
                Notify();
                return;
            }

            var track = _trackCollection.Search(trackName);

            _trackCollection.Remove(track);
            _trackCollection.Insert(dropIndex, track);
        }
示例#2
0
        public void RemoveTrack(Track track)
        {
            Album  album  = track.Album;
            Artist artist = track.Artist;

            _tracks.Remove(track);
            if (album != null)
            {
                album.Tracks.Remove(track);
                if (album.Tracks.Count == 0)
                {
                    _albums.Remove(album);
                }
            }

            if (artist != null)
            {
                if (artist.Albums.Count == 0)
                {
                    _artists.Remove(artist);
                }
            }

            _trackDict.Remove(track.FilePath);
        }
        public void TestRemove()
        {
            var myCollection = new TrackCollection {
                _testTrack
            };

            myCollection.Remove(_testTrack.Path);
            Assert.IsFalse(myCollection.IsPresent(_testTrack));
        }
示例#4
0
        private Population CreateInitialPopulation(TrackCollection trackCollection)
        {
            var population      = new Population();
            var randomGenerator = new Random();

            population.Add(trackCollection);
            for (var k = 1; k < _populationSize; k++)
            {
                var individual = new TrackCollection();
                individual.AddRange(trackCollection);
                for (var i = 0; i < individual.Count; i++)
                {
                    var track = individual[i];
                    individual.Remove(track);
                    individual.Insert(randomGenerator.Next(individual.Count), track);
                }
                population.Add(individual);
            }
            return(population);
        }