Exemplo n.º 1
0
        private void RegisterMessages()
        {
            Messenger.Default.Register <MediaLink>(
                this,
                async media =>
            {
                // Close flyout if open
                _relatedContentFlyout.CloseFlyout();

                // Set the media
                await SetMedia(media);
                _playList.Clear();
                _selectedPlayListId = null;
                IsPlaylistSelected  = false;
                RefreshCommands();
                HandleNotSupportedMedia(Media);
            });

            Messenger.Default.Register <PlaylistSelectedMessage>(
                this,
                async message =>
            {
                var playListMedia   = await _playlistDataService.GetPlayListMedia(message.PlaylistID);
                _selectedPlayListId = message.PlaylistID;
                playListMedia.ForEach(m => m.IsInternalMode = IsInternalModeEnable);
                _playList.Clear();
                _playList.AddRange(playListMedia.Where(m => m.IsVisible));
                IsPlaylistSelected = true;
                RefreshCommands();
            });

            Messenger.Default.Register <SwipeMessage>(
                this,
                swipeMessage =>
            {
                if (_navigationService.CurrentPageKey != ViewModelLocator.MediaContentPageKey)
                {
                    return;
                }

                if (swipeMessage is SwipeMessage.LeftSwipe)
                {
                    GoToNextCommand.Execute(this);
                }
                else
                {
                    GoToPreviousCommand.Execute(this);
                }
            });
        }
 private void Clear()
 {
     if (CurrentPlaylist != null)
     {
         if (HasChanges)
         {
             if (MessageBox.Show("Do you wish to save changes in " +
                                 CurrentPlaylist.PlaylistName + " ?",
                                 CurrentPlaylist.PlaylistName, MessageBoxButton.OKCancel)
                 == MessageBoxResult.OK)
             {
                 this.UpdateList();
             }
         }
     }
     CurrentPlaylist = null;
     PlayListCollection.Clear();
     //foreach (var item in PlayList)
     //{
     //    if (item == MediaControllerVM.MediaControllerInstance.CurrentVideoItem) continue;
     //    PlayList.Remove(item);
     //}
 }