/// <summary> /// Plays this instance. /// </summary> /// <param name="file"></param> public virtual void Play(StorableTaggedFile file) { file.Guard("file"); var oldCurrent = CurrentTrack; var newChannel = new TrackContainer(player, file); try { newChannel.Preload(); } catch (Exception e) { newChannel.Dispose(); LogException(e, MethodBase.GetCurrentMethod()); LogWarning("File Was: {0}", file.Filename); return; } SwapChannels(newChannel); if (null != oldCurrent) { PushContainer(oldCurrent); } var index = playlistService.Files.IndexOf(file); if (index < 0) { return; } playlistService.SetPlaylistIndex(file); ReBuffer(); }
/// <summary> /// Initializes a new instance of the <see cref="TrackContainer" /> class. /// </summary> /// <param name="player">The player.</param> /// <param name="file">The file.</param> public TrackContainer(IAudioPlayer player, StorableTaggedFile file) { player.Guard("player"); file.Guard("file"); this.player = player; File = file; }