private void CommandBinding_PlayVideo(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) return; try { if (obj.GetType() == typeof(VideoDetailedVM)) { VideoDetailedVM vid = obj as VideoDetailedVM; bool force = true; 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); this.Close(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_PlayVideo(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VideoDetailedVM)) { VideoDetailedVM vid = obj as VideoDetailedVM; bool force = true; 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); this.Close(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_PlayVideo(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) return; try { if (obj.GetType() == typeof(VideoDetailedVM)) { VideoDetailedVM vid = obj as VideoDetailedVM; //AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; 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); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_PlayEpisode(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) return; try { if (obj.GetType() == typeof(PlaylistItemVM)) { PlaylistItemVM pli = obj as PlaylistItemVM; AnimeEpisodeVM ep = null; if (pli.ItemType == JMMClient.PlaylistItemType.Episode) { ep = pli.PlaylistItem as AnimeEpisodeVM; } if (pli.ItemType == JMMClient.PlaylistItemType.AnimeSeries) { AnimeSeriesVM ser = pli.PlaylistItem as AnimeSeriesVM; if (ser == null) return; JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(ser.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract != null) ep = new AnimeEpisodeVM(contract); } if (ep == null) return; ep.SetTvDBInfo(); 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) { if (AppSettings.AutoFileSingleEpisode) { VideoDetailedVM 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); } }
private void CommandBinding_PlayEpisode(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) return; try { if (obj.GetType() == typeof(AnimeEpisodeDisplayVM)) { AnimeEpisodeDisplayVM ep = obj as AnimeEpisodeDisplayVM; 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) { if (AppSettings.AutoFileSingleEpisode) { VideoDetailedVM 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); bool? result = frm.ShowDialog(); } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void btnPlayNextEp_Click(object sender, RoutedEventArgs e) { if (UnwatchedEpisodes.Count == 0) return; try { AnimeEpisodeVM ep = UnwatchedEpisodes[0]; if (ep.IsWatched == 1) { if (UnwatchedEpisodes.Count == 1) ep = UnwatchedEpisodes[1]; else return; } if (ep.FilesForEpisode.Count == 1) { bool force = true; if (MainWindow.videoHandler.DefaultPlayer.Player.ToString() != Enum.GetName(typeof(VideoPlayer), VideoPlayer.WindowsDefault)) { 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) { if (AppSettings.AutoFileSingleEpisode) { VideoDetailedVM 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 { MainWindow mainwdw = (MainWindow)Window.GetWindow(this); PlayVideosForEpisodeForm frm = new PlayVideosForEpisodeForm(); frm.Owner = mainwdw; frm.Init(ep); bool? result = frm.ShowDialog(); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_PlayEpisode(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); try { AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; 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); } }
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 AnimeEpisodeVM ep = lbEpisodes.SelectedItem as AnimeEpisodeVM; if (ep != null) { ep.RefreshFilesForEpisode(); if (ep.FilesForEpisode.Count == 1) { bool force = true; 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) { VideoDetailedVM vid = MainWindow.videoHandler.GetAutoFileForEpisode(ep); if (vid != null) { bool force = true; 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()); } }