private void PlayMovieOrShowDVDContextMenu() { if (_useDVDContextMenu && _movieDetails.TitleObject.SelectedDisk.Format == VideoFormat.DVD) { _dvdContextMenu = null; MediaSource ms = new MediaSource(_movieDetails.TitleObject.SelectedDisk); if (ms.DVDTitle != null && ms.DVDTitle.AudioTracks.Count > 0) { CreateDvdContextMenuIfNeeded(); ICommand cmd = new Command(); cmd.Description = "Change Audio"; _dvdContextMenu.AddAudioCommand(cmd); IList audList = new List<string>(); foreach (var audio in ms.DVDTitle.AudioTracks) audList.Add(audio.ToString()); Choice audChoice = new Choice(); audChoice.Options = audList; _dvdContextMenu.AudioTracksChoice = audChoice; } if (ms.DVDTitle != null && ms.DVDTitle.Subtitles.Count > 0) { CreateDvdContextMenuIfNeeded(); ICommand cmd = new Command(); cmd.Description = "Change Subtitle"; _dvdContextMenu.AddSubtitleCommand(cmd); IList subList = new List<string>(); subList.Add("None"); foreach (var subtitle in ms.DVDTitle.Subtitles) subList.Add(subtitle.Language); Choice subChoice = new Choice(); subChoice.Options = subList; _dvdContextMenu.SubtitleTracksChoice = subChoice; } if (ms.DVDTitle != null && ms.DVDTitle.Chapters.Count > 0) { CreateDvdContextMenuIfNeeded(); ICommand cmd = new Command(); cmd.Description = "Select Chapter"; _dvdContextMenu.AddChapterCommand(cmd); IList chapList = new List<string>(); chapList.Add("None"); foreach (var chapter in ms.DVDTitle.Chapters) chapList.Add(string.Format("Chapter {0}", chapter.ChapterNumber)); Choice chapChoice = new Choice(); chapChoice.Options = chapList; _dvdContextMenu.ChapterSelectionChoice = chapChoice; } if (_dvdContextMenu != null) { ICommand playCmd = new Command(); playCmd.Description = "Play Now"; _dvdContextMenu.AddPlayCommand(playCmd); ShowDVDContextMenu = true; } else { _movieDetails.PlayMovie(); } } else { _movieDetails.PlayMovie(); } }
private void CreateDvdContextMenuIfNeeded() { if ( _dvdContextMenu == null ) _dvdContextMenu = new ContextMenu(); }