/// <summary> /// Instantiates the playlist generators list view model /// </summary> /// <param name="container"></param> /// <param name="regionManager"></param> public PlaylistGeneratorsListViewModel(IUnityContainer container) : base(container) { // get the playlist manager PlaylistManager playlistManager = Container.Resolve <PlaylistManager>(); // loop through playlist generators and create view models foreach (PlaylistGenerator playlistGenerator in playlistManager.GetPlaylistGenerators()) { PlaylistGeneratorVMs.Add( Container.Resolve <PlaylistGeneratorViewModel>(playlistGenerator.Name, new ParameterOverride("playlistGenerator", playlistGenerator))); } }
/// <summary> /// Removes selected generators from the list /// </summary> public void RemoveGenerators() { // raise close to ensure all generators are closed //RaiseCloseGenerator(SelectedPlaylistGenerators); foreach (PlaylistGeneratorViewModel playlistGeneratorVM in SelectedPlaylistGenerators) { // stop the generator if (playlistGeneratorVM.Status == PlaylistGeneratorViewModel.StatusType.Running) { playlistGeneratorVM.StopGenerator(); } // remove the generator from the list PlaylistGeneratorVMs.Remove(playlistGeneratorVM); } }
/// <summary> /// Adds a generator to the list /// </summary> /// <param name="playlistGenerator"></param> public void AddGenerator(PlaylistGenerator playlistGenerator) { PlaylistGeneratorVMs.Add(new PlaylistGeneratorViewModel(Container, playlistGenerator)); }