private void OpenSelectedRecording() { try { RecordingSummary recording = GetSelectedRecording(); if (recording != null) { if (Properties.Settings.Default.StreamRecordingsUsingRtsp) { string rtspUrl = null; if (WinFormsUtility.IsVlcInstalled()) { rtspUrl = Proxies.ControlService.StartRecordingStream(recording.RecordingFileName).Result; } if (String.IsNullOrEmpty(rtspUrl) || !WinFormsUtility.RunStreamPlayer(rtspUrl, false)) { MessageBox.Show(this, "Failed to start VLC player.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); if (!String.IsNullOrEmpty(rtspUrl)) { Proxies.ControlService.StopRecordingStream(rtspUrl).Wait(); } } } else if (recording.IsFileOnDisk) { ProcessStartInfo startInfo = new ProcessStartInfo(recording.RecordingFileName); startInfo.WindowStyle = ProcessWindowStyle.Normal; startInfo.UseShellExecute = true; System.Diagnostics.Process.Start(startInfo); Proxies.ControlService.SetRecordingLastWatched(recording.RecordingFileName).Wait(); recording.LastWatchedTime = DateTime.Now; SetRecordingNodeIcon(_recordingsTreeView.SelectedNode); } else { MessageBox.Show(this, "Failed to find recording file.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void OnOpening(System.ComponentModel.CancelEventArgs e) { bool hasSchedule = _scheduleType.HasValue; bool showRecordItems = true; bool isActiveRecording = _activeRecording != null; _playWithVlcItem.Visible = isActiveRecording; _playWithVlcItem.Enabled = WinFormsUtility.IsVlcInstalled(); _abortRecordingItem.Visible = isActiveRecording; _editScheduleItem.Visible = hasSchedule; if (hasSchedule) { bool isRecording = (_scheduleType == ScheduleType.Recording); if (isRecording) { showRecordItems = false; } if (isRecording) { _priorityScheduleItem.Visible = true; _preRecordScheduleItem.Visible = true; _resetToSchedulePreRecordItem = PopulatePrePostRecordItem(_preRecordScheduleItem, _upcomingProgram.PreRecordSeconds, "Reset To Schedule Pre-record", false); _postRecordScheduleItem.Visible = true; _resetToSchedulePostRecordItem = PopulatePrePostRecordItem(_postRecordScheduleItem, _upcomingProgram.PostRecordSeconds, "Reset To Schedule Post-record", true); _separator2.Visible = true; } else { _priorityScheduleItem.Visible = false; _preRecordScheduleItem.Visible = false; _postRecordScheduleItem.Visible = false; _separator2.Visible = false; } _deleteScheduleItem.Visible = !this.IsCancelled && _scheduleType != ScheduleType.Suggestion; _cancelProgramItem.Visible = !isActiveRecording && !this.IsCancelled && this.IsPartOfSeries && _scheduleType != ScheduleType.Suggestion; _uncancelProgramItem.Visible = !isActiveRecording && this.IsCancelled && this.CancellationReason == UpcomingCancellationReason.Manual && _scheduleType != ScheduleType.Suggestion; _addToPreviouslyRecordedHistoryItem.Visible = !isActiveRecording && isRecording && !this.IsCancelled; _removeFromPreviouslyRecordedHistoryItem.Visible = !isActiveRecording && isRecording && this.IsCancelled && this.CancellationReason == UpcomingCancellationReason.PreviouslyRecorded; if (isRecording && _upcomingProgram != null) { foreach (ToolStripItem item in _priorityScheduleItem.DropDownItems) { ToolStripMenuItem menuItem = item as ToolStripMenuItem; if (menuItem != null) { menuItem.Checked = (menuItem.Tag is UpcomingProgramPriority && (UpcomingProgramPriority)menuItem.Tag == _upcomingProgram.Priority); } } } } else { _priorityScheduleItem.Visible = false; _preRecordScheduleItem.Visible = false; _postRecordScheduleItem.Visible = false; _separator2.Visible = false; _deleteScheduleItem.Visible = false; _cancelProgramItem.Visible = false; _uncancelProgramItem.Visible = false; _addToPreviouslyRecordedHistoryItem.Visible = false; _removeFromPreviouslyRecordedHistoryItem.Visible = false; } _recordItem.Visible = showRecordItems; _recordDailyItem.Visible = showRecordItems; _recordWeeklyItem.Visible = showRecordItems; _recordAnyTimeItem.Visible = showRecordItems; _separator1.Visible = hasSchedule && (showRecordItems || isActiveRecording); base.OnOpening(e); }