Ejemplo n.º 1
0
 //COLLECTION METHODS
 #region "Collection Methods"
 //generates an id for the file and adds to the collection
 public void AddToCollection(AudioPlaybackItem item)
 {
     App.Current.Dispatcher.Invoke(delegate {
         item.ChangeId(collection.Count);
         collection.Add(item);
     });
 }
Ejemplo n.º 2
0
        //MEDIA CONTROL
        #region "Media Control"
        public void Play(int id, string requester)
        {
            AudioPlaybackItem item = afm.getCollection().ElementAt(id);

            App.Current.Dispatcher.Invoke(delegate
            {
                AudioFileReader reader = new AudioFileReader(item.path);
                TimeSpan duration      = TimeSpan.FromSeconds((int)reader.TotalTime.TotalSeconds);

                audioQueue.Add(new AudioQueueItem(item.name, item.path, duration, requester));
            });

            if (!currentlyPlaying)
            {
                PlayAudioFile(item.path, item.volume, tokenSource.Token);
            }
        }