public TracklistBaseViewModel(
            INavigationService navigationService,
            IResourceService resourceService,
            IFlyoutNavigationService flyoutNavigationService,
            IDataService dataService,
            IPlayerManager playerManager,
            IImageService imageService,
            IEventAggregator eventAggregator) : base(navigationService, resourceService)
        {
            _flyoutNavigationService = flyoutNavigationService;
            _dataService             = dataService;
            _playerManager           = playerManager;
            _imageService            = imageService;
            _eventAggregator         = eventAggregator;

            _eventAggregator.GetEvent <PlaylistActionContextChanged>().Subscribe(async args =>
            {
                if (args is PlaylistActionContext managePlaylistContext)
                {
                    switch (managePlaylistContext.ActionMode)
                    {
                    case PlaylistActionMode.AddToPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await AddToPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.SelectPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await SelectPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.CreatePlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await CreateNewPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.RemoveFromPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await RemoveFromPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.RemovePlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await RemovePlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.PlaylistDeleted:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await NavigationService.GoBackAsync();
                        break;
                    }
                }
            }, ThreadOption.UIThread);
        }
 public AlbumDetailPageViewModel(INavigationService navigationService,
                                 IFlyoutNavigationService flyoutNavigationService,
                                 IEventAggregator eventAggregator,
                                 IResourceService resourceService,
                                 IDataService dataService,
                                 IImageService imageService,
                                 IPlayerManager playerManager) : base(
         navigationService,
         resourceService,
         flyoutNavigationService,
         dataService,
         playerManager,
         imageService,
         eventAggregator)
 {
     _dataService  = dataService;
     _imageService = imageService;
 }
예제 #3
0
        public NowPlayingPageViewModel(
            INavigationService navigationService,
            IResourceService resourceService,
            IDataService dataService,
            IPageDialogService pageDialogService,
            IImageService imageService,
            IFlyoutNavigationService flyoutNavigationService,
            IEventAggregator eventAggregator,
            IPlayerManager playerManager) : base(navigationService, resourceService, pageDialogService, playerManager, eventAggregator)
        {
            _dataService             = dataService;
            _imageService            = imageService;
            _flyoutNavigationService = flyoutNavigationService;
            _eventAggregator         = eventAggregator;

            _eventAggregator.GetEvent <PlaylistActionContextChanged>().Subscribe(async args =>
            {
                if (args is PlaylistActionContext managePlaylistContext)
                {
                    switch (managePlaylistContext.ActionMode)
                    {
                    case PlaylistActionMode.AddToPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await AddToPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.SelectPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await SelectPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.CreatePlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await CreateNewPlaylist(managePlaylistContext);
                        break;
                    }
                }
            }, ThreadOption.UIThread);

            _eventAggregator.GetEvent <AlbumInfoSelectionEvent>().ShowAlbum(async(uniqueTrack) =>
            {
                await CloseDialog();
            });
        }
예제 #4
0
 public MainPageViewModel(
     INavigationService navigationService,
     IFlyoutNavigationService flyoutNavigationService,
     IResourceService resourceService,
     IPlayerManager playerManager,
     IEventAggregator eventAggregator,
     IPageDialogService pageDialogService,
     IDataService dataService)
     : base(navigationService, resourceService, pageDialogService, playerManager, eventAggregator)
 {
     _flyoutNavigationService = flyoutNavigationService;
     _playerManager           = playerManager;
     _pageDialogService       = pageDialogService;
     _dataService             = dataService;
     _eventAggregator         = eventAggregator;
     _eventAggregator.GetEvent <TrackChangedEvent>().Subscribe((args) =>
     {
         if (args is Track track)
         {
             CurrentTrack = track;
             LoadCoverSource(CurrentTrack);
         }
     }, ThreadOption.UIThread);
 }
        public TracklistBaseViewModel(
            INavigationService navigationService,
            IResourceService resourceService,
            IFlyoutNavigationService flyoutNavigationService,
            IDataService dataService,
            IPlayerManager playerManager,
            IImageService imageService,
            IEventAggregator eventAggregator) : base(navigationService, resourceService)
        {
            _flyoutNavigationService = flyoutNavigationService;
            _dataService             = dataService;
            _playerManager           = playerManager;
            _imageService            = imageService;
            _eventAggregator         = eventAggregator;

            _eventAggregator.GetEvent <PlaylistActionContextChanged>().Subscribe(async args =>
            {
                if (args is PlaylistActionContext managePlaylistContext)
                {
                    switch (managePlaylistContext.ActionMode)
                    {
                    case PlaylistActionMode.AddToPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await AddToPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.SelectPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await SelectPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.CreatePlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await CreateNewPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.RemoveFromPlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await RemoveFromPlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.RemovePlaylist:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await RemovePlaylist(managePlaylistContext);
                        break;

                    case PlaylistActionMode.PlaylistDeleted:
                        managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        await NavigationService.GoBackAsync();
                        break;
                        //case PlaylistActionMode.PlaylistUpdated:
                        //    managePlaylistContext.ActionMode = PlaylistActionMode.None;
                        //    break;
                    }
                    //if (managePlaylistContext.ActionMode == PlaylistActionMode.Append)
                    //{
                    //    if (managePlaylistContext.PlaylistTo == null)
                    //    {
                    //        SelectPlaylist(managePlaylistContext);
                    //    }
                    //    else
                    //    {
                    //        AddToPlaylist(managePlaylistContext);
                    //    }

                    //}
                    //if (managePlaylistContext.ActionMode == PlaylistActionMode.Remove)
                    //{
                    //    RemoveFromPlaylist(managePlaylistContext);
                    //}
                    //if (managePlaylistContext.ActionMode == PlaylistActionMode.New)
                    //{
                    //    CreateNewPlaylist(managePlaylistContext);
                    //}
                    //if (managePlaylistContext.ActionMode == PlaylistActionMode.Deleted)
                    //{
                    //    await NavigationService.NavigateAsync($"{ nameof(NavigationPage)}/{nameof(PlaylistsPage)}");
                    //}
                    //if (managePlaylistContext.ActionMode == PlaylistActionMode.Updated)
                    //{
                    //    //var playlist = managePlaylistContext.PlaylistTo;
                    //    //if (playlist != null)
                    //    //{
                    //    //    await _imageService.RemoveStitchedBitmaps(playlist.Id);
                    //    //}
                    //    //managePlaylistContext.ActionMode = PlaylistActionMode.None;
                    //}
                }
            }, ThreadOption.UIThread);
        }