public void DisplayFiles() { try { VM_AnimeEpisode_User ep = DataContext as VM_AnimeEpisode_User; if (ep != null) { ep.RefreshFilesForEpisode(); lbFiles.ItemsSource = ep.FilesForEpisode; if (!ep.HasFiles) { List <CL_AniDB_GroupStatus> relGroups = ep.ReleaseGroups; if (relGroups.Count > 0) { string grpList = ""; foreach (CL_AniDB_GroupStatus rg in relGroups) { if (grpList.Length > 0) { grpList += ", "; } grpList += rg.GroupName; } tbFileDetailsGroups.Text = Shoko.Commons.Properties.Resources.GroupsAvailableFrom + " " + grpList; } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_PlayEpisode(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); try { VM_AnimeEpisode_User ep = DataContext as VM_AnimeEpisode_User; ep.RefreshFilesForEpisode(); if (ep.FilesForEpisode.Count > 0) { bool force = true; if (MainWindow.videoHandler.DefaultPlayer.Player.ToString() != Enum.GetName(typeof(VideoPlayer), VideoPlayer.WindowsDefault)) { if (ep.FilesForEpisode[0].VideoLocal_ResumePosition > 0) { AskResumeVideo ask = new AskResumeVideo(ep.FilesForEpisode[0].VideoLocal_ResumePosition); ask.Owner = Window.GetWindow(this); if (ask.ShowDialog() == true) { force = false; } } } MainWindow.videoHandler.PlayVideo(ep.FilesForEpisode[0], force); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void DisplayFiles() { try { VM_AnimeEpisode_User ep = DataContext as VM_AnimeEpisode_User; if (ep != null) { ep.RefreshFilesForEpisode(); ep.RefreshAnime(); fileSummary.DataContext = null; fileSummary.DataContext = ep.AniDB_Anime; lbFiles.ItemsSource = ep.FilesForEpisode; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void lbEpisodes_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { FrameworkElement ctrl = e.OriginalSource as FrameworkElement; if (ctrl == null || lbEpisodes.SelectedItem == null) { return; } // The below while loop, etc. is used to make sure that the double click event is coming from an episode detail. // When the ListBox is responsible for rendering the scrollbar, it turns out that the scrollbar will also raise // double click events. So we'll see if the EpisodeDetail is an ancestor of the original source of the event bool srcWasListItem = false; while (ctrl != null) { if (ctrl is EpisodeDetail) { srcWasListItem = true; break; } ctrl = ctrl.Parent as FrameworkElement; } if (!srcWasListItem) { return; // The source of the event wasn't an EpisodeDetail } VM_AnimeEpisode_User ep = lbEpisodes.SelectedItem as VM_AnimeEpisode_User; if (ep != null) { ep.RefreshFilesForEpisode(); if (ep.FilesForEpisode.Count == 1) { bool force = true; if (MainWindow.videoHandler.DefaultPlayer.Player.ToString() != Enum.GetName(typeof(VideoPlayer), VideoPlayer.WindowsDefault)) { if (ep.FilesForEpisode[0].VideoLocal_ResumePosition > 0) { AskResumeVideo ask = new AskResumeVideo(ep.FilesForEpisode[0].VideoLocal_ResumePosition); ask.Owner = Window.GetWindow(this); if (ask.ShowDialog() == true) { force = false; } } } MainWindow.videoHandler.PlayVideo(ep.FilesForEpisode[0], force); } else if (ep.FilesForEpisode.Count > 1) { Window parentWindow = Window.GetWindow(this); if (AppSettings.AutoFileSingleEpisode) { VM_VideoDetailed vid = MainWindow.videoHandler.GetAutoFileForEpisode(ep); if (vid != null) { bool force = true; if (MainWindow.videoHandler.DefaultPlayer.Player.ToString() != Enum.GetName(typeof(VideoPlayer), VideoPlayer.WindowsDefault)) { if (vid.VideoLocal_ResumePosition > 0) { AskResumeVideo ask = new AskResumeVideo(vid.VideoLocal_ResumePosition); ask.Owner = Window.GetWindow(this); if (ask.ShowDialog() == true) { force = false; } } } MainWindow.videoHandler.PlayVideo(vid, force); } } else { PlayVideosForEpisodeForm frm = new PlayVideosForEpisodeForm(); frm.Owner = parentWindow; frm.Init(ep); frm.ShowDialog(); } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex.ToString()); } }