Ejemplo n.º 1
0
        public SongViewModel()
        {
            _song     = null;
            _songRepo = new SongRepository();
            PlayMedia = new RelayCommand(new Action <object>(SendPlayMediaMessage));

            // listens to SongListViewModel.cs
            Messenger.Default.Register <Song>(this, UpdateCurrentSong, "UpdateCurrentSong");

            // SongView Code Behind Sends this
            Messenger.Default.Register <bool>(this, IncrementSong, "PlayNextSong");
            Messenger.Default.Register <TimeSpan>(this, UpdateSongTime, "TimeSpanFound");
            Messenger.Default.Register <int>(this, IncrementTimeStamp, "IncrementDuration");
        }
Ejemplo n.º 2
0
        public SongListViewModel(SongRepository repo)
        {
            _songRepository = repo;
            _songs = new ObservableCollection<Song>(_songRepository.GetSongs());
            _songRepository.Dispose();
            MediaControl = new RelayCommand(new Action<object>(SendMediaControlMessage));

            // Listens for PlaylistListViewModel.cs to select a playlist
            Messenger.Default.Register<Playlist>(this, UpdateSongsList, "PlaylistSelected");

            Messenger.Default.Register<bool>(this, RefreshSongList, "SongUpdated");

            Messenger.Default.Register<bool>(this, CanPlaySongUpdate, "NoCredits");
        }
Ejemplo n.º 3
0
        public SongListViewModel(SongRepository repo)
        {
            _songRepository = repo;
            _songs          = new ObservableCollection <Song>(_songRepository.GetSongs());
            _songRepository.Dispose();
            MediaControl = new RelayCommand(new Action <object>(SendMediaControlMessage));

            // Listens for PlaylistListViewModel.cs to select a playlist
            Messenger.Default.Register <Playlist>(this, UpdateSongsList, "PlaylistSelected");

            Messenger.Default.Register <bool>(this, RefreshSongList, "SongUpdated");

            Messenger.Default.Register <bool>(this, CanPlaySongUpdate, "NoCredits");
        }
Ejemplo n.º 4
0
        public SongViewModel()
        {
            _song = null;
            _songRepo = new SongRepository();
            PlayMedia = new RelayCommand(new Action<object>(SendPlayMediaMessage));

            // listens to SongListViewModel.cs
            Messenger.Default.Register<Song>(this, UpdateCurrentSong, "UpdateCurrentSong");

            // SongView Code Behind Sends this
            Messenger.Default.Register<bool>(this, IncrementSong, "PlayNextSong");
            Messenger.Default.Register<TimeSpan>(this, UpdateSongTime, "TimeSpanFound");
            Messenger.Default.Register<int>(this, IncrementTimeStamp, "IncrementDuration");
        }
Ejemplo n.º 5
0
        public AddSongViewModel()
        {
            _artRepo       = new ArtRepository();
            _artCollection = new ObservableCollection <string>(_artRepo.GetAllArt());

            _songRepo = new SongRepository();

            AddNewSongCommand = new RelayCommand(new Action <object>(AddNewSong), Predicate => {
                if (TitleRule.TitleRegex.IsMatch(Title) &&
                    TitleRule.TitleRegex.IsMatch(Artist) &&
                    DurationRule.DurationRegex.IsMatch(Duration) &&
                    RequiredRule.RequiredRegex.IsMatch(SongPath))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            });
            CloseAddNewSongViewCommand = new RelayCommand(new Action <object>(CloseNewSongView));
            BrowseSongCommand          = new RelayCommand(new Action <object>(BrowseSong));
        }
Ejemplo n.º 6
0
        public AddSongViewModel()
        {
            _artRepo = new ArtRepository();
            _artCollection = new ObservableCollection<string>(_artRepo.GetAllArt());

            _songRepo = new SongRepository();

            AddNewSongCommand = new RelayCommand(new Action<object>(AddNewSong), Predicate => {
                if(TitleRule.TitleRegex.IsMatch(Title) &&
                    TitleRule.TitleRegex.IsMatch(Artist) &&
                    DurationRule.DurationRegex.IsMatch(Duration) &&
                    RequiredRule.RequiredRegex.IsMatch(SongPath))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            });
            CloseAddNewSongViewCommand = new RelayCommand(new Action<object>(CloseNewSongView));
            BrowseSongCommand = new RelayCommand(new Action<object>(BrowseSong));
        }
Ejemplo n.º 7
0
 private void ClearRepository(SongRepository repo)
 {
     repo.Dispose();
 }
Ejemplo n.º 8
0
 public SongListViewModel(int playlistid)
 {
     _songRepository = new SongRepository(playlistid);
     _songs = new ObservableCollection<Song>(_songRepository.GetSongs());
 }
Ejemplo n.º 9
0
 public SongListViewModel()
 {
     _songRepository = new SongRepository();
     _songs = new ObservableCollection<Song>();
 }
Ejemplo n.º 10
0
 private void ClearRepository(SongRepository repo)
 {
     repo.Dispose();
 }
Ejemplo n.º 11
0
 public SongListViewModel(int playlistid)
 {
     _songRepository = new SongRepository(playlistid);
     _songs          = new ObservableCollection <Song>(_songRepository.GetSongs());
 }
Ejemplo n.º 12
0
 public SongListViewModel()
 {
     _songRepository = new SongRepository();
     _songs          = new ObservableCollection <Song>();
 }