Example #1
0
        private void PlayQueuedSong(QueueItemViewModel vm)
        {
            Log("Sending Media Play", Category.Debug);

            _eventAggregator.GetEvent <OnMediaPlay <AllJoinedTable> >()
            .Publish(vm.QueuedSong);
        }
Example #2
0
        /// <summary>
        /// Called when [remove song]. Removes passed in song from queue
        /// </summary>
        /// <param name="queueItemViewModel">The queue item view model.</param>
        private void OnRemoveSong(QueueItemViewModel queueItemViewModel)
        {
            Log("Removing song from queue", Category.Debug);

            try
            {
                RemoveQueuedSong(queueItemViewModel);
            }
            catch (Exception ex)
            {
                Log(ex.Message, Category.Exception);
                throw;
            }
        }
Example #3
0
 private void QueueSongs_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
     {
         try
         {
             var song = e.NewItems[0] as AllJoinedTable;
             if (song != null)
             {
                 QueueItemViewModel queueItemVm = _unityContainer.Resolve(typeof(QueueItemViewModel)) as QueueItemViewModel;
                 queueItemVm.QueuedSong = song;
                 QueueItems.Add(queueItemVm);
             }
         }
         catch (Exception ex)
         {
             Log(ex.Message, Category.Exception);
             throw;
         }
     }
 }
Example #4
0
        private void PlayQueueItem(QueueItemViewModel vm)
        {
            if (vm != null)
            {
                Log("Sending Media Play", Category.Debug);

                try
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        PlayQueuedSong(vm);
                        OnRemoveSong(vm);
                    });
                }
                catch (Exception ex)
                {
                    Log(ex.Message, Category.Exception);
                    throw;
                }
            }
        }
Example #5
0
 /// <summary>
 /// Removes the queued song from the provider and the local collection
 /// </summary>
 /// <param name="queueItemViewModel">The queue item view model.</param>
 private void RemoveQueuedSong(QueueItemViewModel queueItemViewModel)
 {
     _queuedSongDataProvider.QueueSongs.Remove(queueItemViewModel.QueuedSong);
     QueueItems.Remove(queueItemViewModel);
 }