public PlaybackMenuViewModel(IAudioPlaylist audioPlaylist, IDukeboxUserSettings userSettings) : base()
        {
            _audioPlaylist = audioPlaylist;
            _userSettings  = userSettings;

            ShuffleOn   = _userSettings.Shuffle;
            RepeatOn    = _userSettings.Repeat;
            RepeatAllOn = _userSettings.RepeatAll;

            Shuffle = new RelayCommand(() =>
            {
                audioPlaylist.Shuffle = !ShuffleOn;
                ShuffleOn             = !ShuffleOn;
            });
            Repeat = new RelayCommand(() =>
            {
                audioPlaylist.Shuffle = !RepeatOn;
                RepeatOn = !RepeatOn;
            });
            RepeatAll = new RelayCommand(() =>
            {
                audioPlaylist.Shuffle = !RepeatAllOn;
                RepeatAllOn           = !RepeatAllOn;
            });
        }
        public TrackListingPreviewViewModel(IAudioPlaylist audioPlaylist, IMusicLibrary musicLibrary)
        {
            _audioPlaylist = audioPlaylist;
            _musicLibrary  = musicLibrary;

            _tracks = new List <ITrack>();

            LoadTrack = new RelayCommand <ITrack>(DoLoadTrack);

            RegisterMessageHandlers();
        }
Example #3
0
        public LibraryListingViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist) : base()
        {
            _musicLibrary            = musicLibrary;
            _musicLibrary.SongAdded += (o, e) => RefreshTrackListing();

            _audioPlaylist = audioPlaylist;

            ClearSearch = new RelayCommand(() => SearchText = string.Empty);
            LoadTrack   = new RelayCommand <ITrack>(DoLoadTrack);

            RefreshTrackListing();
        }
        public CurrentlyPlayingListingViewModel(IAudioPlaylist audioPlaylist) : base()
        {
            _audioPlaylist    = audioPlaylist;
            _listSearchHelper = new ListSearchHelper <ITrack>
            {
                FilterLambda = (t, s) => t.ToString().ToLower().Contains(s.ToLower())
            };

            _audioPlaylist.TrackListModified += (o, e) => RefreshTracks();

            ClearSearch = new RelayCommand(() => SearchText = string.Empty);
            LoadTrack   = new RelayCommand <ITrack>(DoLoadTrack);

            RefreshTracks();
        }
Example #5
0
        public AudioCdMenuViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist, IAudioCdRippingService cdRippingService) : base()
        {
            _musicLibrary     = musicLibrary;
            _audioPlaylist    = audioPlaylist;
            _cdRippingService = cdRippingService;

            _selectAudioCdDriveDialog = new FolderBrowserDialog();
            _selectMp3OutputDialog    = new FolderBrowserDialog();
            _driveRootRegex           = new Regex(DriveRootRegex);

            _selectAudioCdDriveDialog.Description = AudioCdBrowserPrompt;
            _selectMp3OutputDialog.Description    = Mp3OutputBrowserPrompt;

            PlayAudioCd   = new RelayCommand(DoPlayAudioCd);
            RipCdToFolder = new RelayCommand(DoRipCdToFolder);
        }
        public PlaybackMonitorViewModel(IMediaPlayer mediaPlayer, IAudioPlaylist audioPlaylist,
                                        IGlobalMultimediaHotKeyService globalHotKeyService, IAlbumArtCacheService albumArtCache,
                                        ImageToImageSourceConverter imageToImageSourceConverter) : base()
        {
            _mediaPlayer                 = mediaPlayer;
            _audioPlaylist               = audioPlaylist;
            _globalHotKeyService         = globalHotKeyService;
            _albumArtCache               = albumArtCache;
            _imageToImageSourceConverter = imageToImageSourceConverter;

            UpdateAlbumArt(ImageResources.DefaultAlbumArtUri);
            PlayPauseImage = ImageResources.PlayImage;

            SetupAudioEventListeners();
            SetupPlaybackControlCommands();

            RegisterHotKeys();
        }
        public AlbumListingViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist) : base()
        {
            _musicLibrary     = musicLibrary;
            _audioPlaylist    = audioPlaylist;
            _listSearchHelper = new ListSearchHelper <Services.Album>
            {
                FilterLambda = Services.Album.ContainsString,
                SortResults  = true,
                SortLambda   = (a) => a.Data.Name.ToLower()
            };

            _musicLibrary.AlbumAdded += (o, e) => LoadAlbumsFromLibrary();

            ClearSearch = new RelayCommand(() => SearchText = string.Empty);
            LoadAlbum   = new RelayCommand <Services.Album>(this.DoLoadAlbum);

            LoadAlbumsFromLibrary();
        }
        public RecentlyPlayedListingViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist) : base()
        {
            _musicLibrary  = musicLibrary;
            _audioPlaylist = audioPlaylist;
            _tracks        = new List <ITrack>();

            _listSearchHelper = new ListSearchHelper <ITrack>
            {
                Items        = _tracks,
                FilterLambda = (t, s) => t.ToString().ToLower().Contains(s.ToLower())
            };

            ClearSearch = new RelayCommand(() => SearchText = string.Empty);
            LoadTrack   = new RelayCommand <ITrack>(DoLoadTrack);

            _musicLibrary.RecentlyPlayedListModified += (o, e) => RefreshRecentlyPlayedFromLibrary();
            RefreshRecentlyPlayedFromLibrary();
        }
        public AudioCdViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist, IAudioCdDriveMonitoringService audioCdDriveMonitor) : base()
        {
            _audioPlaylist       = audioPlaylist;
            _audioCdDriveMonitor = audioCdDriveMonitor;

            _audioCdDriveMonitor.AudioCdInsertedOnLoad += (o, e) => Tracks = e.CdTracks;
            _audioCdDriveMonitor.AudioCdInserted       += (o, e) =>
            {
                Tracks = e.CdTracks;
                OfferToLoadCd(e.DriveDirectory);
            };
            _audioCdDriveMonitor.AudioCdEjected += (o, e) => Tracks = new List <ITrack>();

            Tracks    = new List <ITrack>();
            LoadTrack = new RelayCommand <ITrack>(DoLoadTrack);

            _audioCdDriveMonitor.StartMonitoring();
        }
        public PlaylistMenuViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist) : base()
        {
            _musicLibrary  = musicLibrary;
            _audioPlaylist = audioPlaylist;

            _selectFileDialog = new OpenFileDialog();
            _saveFileDialog   = new SaveFileDialog();

            _selectFileDialog.Filter = PlaylistFileFilter;
            _saveFileDialog.Filter   = PlaylistFileFilter;

            // enable saving playlist when tracks are present
            _audioPlaylist.TrackListModified += (o, e) => SaveToFileEnabled = audioPlaylist.Tracks.Count > 0;

            Clear                   = new RelayCommand(_audioPlaylist.ClearPlaylist);
            LoadFromFile            = new RelayCommand(DoLoadFromFile);
            SaveToFile              = new RelayCommand(DoSaveToFile);
            ImportPlaylistToLibrary = new RelayCommand(DoPlayListImport);
        }
        public ArtistListingViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist) : base()
        {
            _musicLibrary  = musicLibrary;
            _audioPlaylist = audioPlaylist;

            _listSearchHelper = new ListSearchHelper <Artist>
            {
                FilterLambda = (a, s) => a.Name.ToLower().Contains(s.ToLower()),
                SortResults  = true,
                SortLambda   = (a) => a.Name.ToLower()
            };

            _musicLibrary.ArtistAdded += (o, e) => RefreshArtistsFromLibrary();

            LoadArtist  = new RelayCommand <Artist>(DoLoadArtist);
            ClearSearch = new RelayCommand(() => SearchText = string.Empty);

            RefreshArtistsFromLibrary();
        }
Example #12
0
        public FileMenuViewModel(IMusicLibrary musicLibrary, IAudioPlaylist audioPlaylist, AudioFileFormats audioFileFormats) : base()
        {
            _musicLibrary = musicLibrary;
            _audioPlaylist = audioPlaylist;

            _selectFileDialog = new OpenFileDialog();
            _selectFolderDialog = new FolderBrowserDialog();

            audioFileFormats.FormatsLoaded += (o, e) => _selectFileDialog.Filter = audioFileFormats.FileDialogFilter;
            _selectFolderDialog.Description = FolderBrowserPrompt;

            PlayFile = new RelayCommand(DoPlayFile);
            PlayFolder = new RelayCommand(DoPlayFolder);
            AddFilesToLibrary = new RelayCommand(DoAddFilesToLibrary);

            // todo: add import/export library routines

            Exit = new RelayCommand(() => Application.Current.Shutdown());
        }
Example #13
0
        public MainWindowViewModel(IAudioPlaylist audioPlaylist) : base()
        {
            _audioPlaylist = audioPlaylist;

            ShowCurrentlyPlayingListing = Visibility.Hidden;
            ShowLibraryListing          = Visibility.Visible;
            ShowAlbumListing            = Visibility.Hidden;
            ShowArtistListing           = Visibility.Hidden;
            ShowRecentlyPlayedListing   = Visibility.Hidden;
            ShowAudioCdListing          = Visibility.Hidden;

            ShowLoadingScreen      = new RelayCommand(DoShowSplashScreen);
            NavBarItemClickCommand = new RelayCommand <string>(NavBarItemClicked);
            StopAudio = new RelayCommand(DoStopAudio);

            // Enable passing message to show currently playing view
            Messenger.Default.Register <NotificationMessage>(this, (nm) =>
            {
                if (nm.Notification == NotificationMessages.AudioPlaylistLoadedNewTracks)
                {
                    NavBarItemClicked(NavIconNames.CurrentlyPlaying);
                }
            });
        }