コード例 #1
0
 /// <summary>
 /// Plays a selected track from ListView
 /// </summary>
 /// <param name="selectedTrack"></param>
 private void playSelectedTrack(TrackMetadata selectedTrack)
 {
     if (SelectAllTracks != true)
     {
         musicplayer.SetActiveTrackInPlayableContainer(TracksManager.db_GetAllTracks().Find(x => x.title == selectedTrack.Title));
         playMusic();
     }
     else
     {
         musicplayer.SetActiveTrack(TracksManager.db_GetAllTracks().Find(x => x.title == selectedTrack.Title));
         playMusic();
         SelectAllTracks = false;
     }
 }
コード例 #2
0
        public void SetActiveTrack(Track track)
        {
            PlayableContainer tracks = new Playlist("All Tracks");

            foreach (Track item in TracksManager.db_GetAllTracks())
            {
                tracks.Tracks.AddLast(item);
            }
            Musicqueue.LoadPlayableContainerInQueue(tracks);

            LinkedListNode <Track> test = Musicqueue.Queue.Find(track);

            SetActiveTrackInPlayableContainer(track);
        }
コード例 #3
0
        /// <summary>
        /// Passes data from all tracks to View
        /// </summary>
        private void createTracksView()
        {
            TitleViewModel.Tracks.Clear();

            foreach (Track track in TracksManager.db_GetAllTracks())
            {
                TrackMetadata md = new TrackMetadata();
                if (track.title == null)
                {
                    md.Title = "unkown";
                    MetadataEditor.AddTitle(track.audio, "unknown");
                }
                else
                {
                    md.Title = track.title;
                    MetadataEditor.AddTitle(track.audio, track.title);
                }
                if (MetadataEditor.GetGenres(track.audio) == null || MetadataEditor.GetGenres(track.audio).Count() == 0)
                {
                    md.Genre = "unkown";
                    MetadataEditor.AddGenre(track.audio, new String[] { "unknown" });
                }
                else
                {
                    md.Genre = MetadataEditor.GetGenres(track.audio)[0];
                }
                if (MetadataEditor.GetArtists(track.audio) == null || MetadataEditor.GetArtists(track.audio).Count() == 0)
                {
                    md.Artist = "unknown";
                    MetadataEditor.AddArtist(track.audio, new String[] { "unknown" });
                }
                else
                {
                    md.Artist = MetadataEditor.GetArtists(track.audio)[0];
                }
                if (MetadataEditor.GetYear(track.audio) == 0)
                {
                    md.Year = "unknown";
                }
                else
                {
                    md.Year = MetadataEditor.GetYear(track.audio).ToString();
                }
                if (MetadataEditor.GetAlbum(track.audio) == null)
                {
                    md.Album = "unknown";
                    MetadataEditor.AddAlbum(track.audio, "unknown");
                }
                else
                {
                    md.Album = MetadataEditor.GetAlbum(track.audio);
                }
                if (MetadataEditor.GetDuration(track.audio).ToString(@"hh\:mm\:ss") == "00:00:00")
                {
                    md.Length = "unknown";
                }
                else
                {
                    md.Length = MetadataEditor.GetDuration(track.audio).ToString(@"hh\:mm\:ss");
                }
                TitleViewModel.Tracks.Add(md);
            }

            SelectAllTracks = true;
            CurrentFrame    = "TitleView.xaml";
        }
コード例 #4
0
 /// <summary>
 /// Plays a selected track from ListView
 /// </summary>
 /// <param name="selectedTrack"></param>
 private void playSelectedTrack(TrackMetadata selectedTrack)
 {
     MainViewModel.musicplayer.SetActiveTrack(TracksManager.db_GetAllTracks().Find(x => x.title == selectedTrack.Title));
     mainViewModel.playMusic();
 }