private bool OnAbortActiveRecording(ActiveRecording rec) { using (ControlServiceAgent tvControlAgent = new ControlServiceAgent()) { if (rec == null) return false; bool aborted = false; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) return false; dlg.Reset(); dlg.SetHeading(rec.Program.Title); dlg.AddLocalizedString(1449); //Stop recording dlg.AddLocalizedString(979); //Play recorded from beginning dlg.AddLocalizedString(980); //Play recorded from live point Recording recording = tvControlAgent.GetRecordingById(rec.RecordingId); if (recording != null && recording.LastWatchedPosition.HasValue) { dlg.AddLocalizedString(900);//play from last point } dlg.DoModal(GetID); switch (dlg.SelectedId) { case 979: if (recording != null) { RecordedBase.PlayFromPreRecPoint(recording); } break; case 980: RecordedBase.PlayFromLivePoint(rec); break; case 900: if (recording != null) { RecordedBase.PlayRecording(recording, recording.LastWatchedPosition.Value); } break; case 1449: // Abort GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); if (dlgYesNo != null) { dlgYesNo.Reset(); dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.StopRecording)); dlgYesNo.SetLine(1, rec.Program.Channel.DisplayName); dlgYesNo.SetLine(2, rec.Program.Title); dlgYesNo.SetLine(3, string.Empty); dlgYesNo.SetDefaultToYes(false); dlgYesNo.DoModal(GetID); if (dlgYesNo.IsConfirmed) { tvControlAgent.AbortActiveRecording(rec); aborted = true; } } break; } return aborted; } }
private bool OnSelectItem(bool isItemSelected) { if (_currentProgram == null) { if (DateTime.Now < _viewingTime.AddMinutes(_timePerBlock * 4) && DateTime.Now > _viewingTime) { DoViewThisChannel(); } return true; } if (_currentProgram.StartTime <= DateTime.Now && _currentProgram.StopTime > DateTime.Now) { ActiveRecording activeRecording; if (PluginMain.IsActiveRecording(_currentChannel.ChannelId, _currentProgram, out activeRecording)) { Log.Info("TVGuide: clicked on a currently running recording"); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return true; } dlg.Reset(); dlg.SetHeading(_currentProgram.Title); dlg.AddLocalizedString(979); //Play recording from beginning dlg.AddLocalizedString(938); //View this channel dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) return true; switch (dlg.SelectedId) { case 979: // Play recording from beginning using (ControlServiceAgent tvControlAgent = new ControlServiceAgent()) { Recording recording = tvControlAgent.GetRecordingById(activeRecording.RecordingId); if (recording != null) { RecordedBase.PlayFromPreRecPoint(recording); } } break; case 938: //View this channel DoViewThisChannel(); break; } } else { DoViewThisChannel(); } } else { ShowProgramInfo(); return false; } return true; }