Ejemplo n.º 1
0
        private void PlayMediaFile(MediaFileInfo file)
        {
            if (_treePlayLists.SelectedItem is PlayList playList)
            {
                playList.IsSelectedPlayList = true;

                int idx = playList.MediaFiles.IndexOf(file);
                if (VM.DB.SelectedMediaFileIndex != idx)
                {
                    file.MediaState = MediaState.Play;
                    VM.DB.SelectedMediaFileIndex = idx;
                }
                else
                {
                    _mediaPlayerCommands.TogglePlayPause_Executed(this, null);
                }
                VM.NotifyPropertyChanged(nameof(PlayListManagerVM.IsPlayingSelectedFile));
            }
        }
Ejemplo n.º 2
0
        public void RemoveMediaFileAndSelectNext(MediaFileInfo info, bool bResetPositionAndPlay, bool bRemoveFromList)
        {
            PlayList playList = MediaDB.SelectedPlayList;
            int      infoIdx  = playList.MediaFiles.IndexOf(info);

            if (bRemoveFromList)
            {
                playList.SelectedMediaFileIndex = playList.RemoveMediaFileFromList(info);
            }
            else //skip missing file - select next
            {
                playList.SelectedMediaFileIndex = playList.SelectNextMediaFile(infoIdx);
            }

            if (bResetPositionAndPlay)
            {
                playList.MediaFiles[playList.SelectedMediaFileIndex].MediaState        = MediaState.Play;
                playList.MediaFiles[playList.SelectedMediaFileIndex].PositionInSeconds = 0;
                //playList.MediaFiles[playList.SelectedMediaFileIndex].Volume = PlayerVM.Volume;
            }

            _cmbFilesList.SelectedIndex = playList.SelectedMediaFileIndex;
        }
Ejemplo n.º 3
0
        private bool ProcessCommandLine()
        {
            if (_commandLine == null || _commandLine.Length == 0)
            {
                return(false);
            }

            string fileName = _commandLine[0];

            if (!File.Exists(fileName))
            {
                return(false);
            }

            if (!Context.AppConfig.Settings.IsSupportedMediaFile(fileName))
            {
                return(false);
            }

            PlayList list = MediaDB.RootList.FindPlayListContainingFile(fileName);

            if (list == null)
            {
                MediaDB.AddNewMediaFile(fileName, PlayerVM.Volume);
                MediaFileInfo info = MediaDB.RootList.FindFile(fileName);
                info.MediaState = MediaState.Play;
            }
            else
            {
                MediaDB.RootList.SetSelectedPlayList(list);
                MediaFileInfo info = list.FindFile(fileName);
                info.MediaState = MediaState.Play;
                MediaDB.SelectedMediaFileIndex = list.MediaFiles.IndexOf(info);
            }

            return(true);
        }
Ejemplo n.º 4
0
 public void RemoveMediaFileAndSelectNext(MediaFileInfo info, bool bResetPositionAndPlay, bool bRemoveFromList)
 {
     throw new NotImplementedException();
 }