private void _programsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3 && e.RowIndex >= 0 && e.RowIndex < _programsDataGridView.Rows.Count) { UpcomingOrActiveProgramView programView = _programsDataGridView.Rows[e.RowIndex].DataBoundItem as UpcomingOrActiveProgramView; if (programView.UpcomingProgram.GuideProgramId.HasValue) { using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent()) { GuideProgram guideProgram = tvGuideAgent.GetProgramById(programView.UpcomingProgram.GuideProgramId.Value); using (ProgramDetailsPopup popup = new ProgramDetailsPopup()) { popup.Channel = programView.UpcomingProgram.Channel; popup.GuideProgram = guideProgram; Point location = Cursor.Position; location.Offset(-250, -40); popup.Location = location; popup.ShowDialog(this); } } } } }
private void _programsDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex != 0 && e.RowIndex >= 0 && e.RowIndex < _upcomingProgramsListBindingSource.Count) { UpcomingOrActiveProgramView programView = _programsDataGridView.Rows[e.RowIndex].DataBoundItem as UpcomingOrActiveProgramView; if (programView != null && (programView.UpcomingProgram.IsCancelled || (programView.UpcomingRecording != null && programView.UpcomingRecording.CardChannelAllocation == null))) { e.CellStyle.ForeColor = Color.DarkGray; e.CellStyle.SelectionForeColor = Color.Gray; } else { e.CellStyle.ForeColor = Color.Black; e.CellStyle.SelectionForeColor = Color.Black; } if (_programsDataGridView.Columns[e.ColumnIndex] is DataGridViewLinkColumn) { if (_programsDataGridView.Rows[e.RowIndex].Selected) { ((DataGridViewLinkCell)_programsDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex]).LinkColor = e.CellStyle.SelectionForeColor; } else { ((DataGridViewLinkCell)_programsDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex]).LinkColor = e.CellStyle.ForeColor; } } } }
private void _programsDataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { foreach (DataGridViewRow row in _programsDataGridView.Rows) { Icon icon = Properties.Resources.TransparentIcon; string toolTip = null; UpcomingOrActiveProgramView programView = row.DataBoundItem as UpcomingOrActiveProgramView; if (programView != null) { ProgramIconUtility.GetIconAndToolTip(_scheduleType, programView.CancellationReason, programView.IsPartOfSeries, this.UnfilteredUpcomingRecordings ?? this.UpcomingPrograms, programView.UpcomingRecording, out icon, out toolTip); if (programView.UpcomingRecording != null && programView.CancellationReason == UpcomingCancellationReason.None) { row.Cells[2].ToolTipText = ProcessUtility.BuildRecordingInfoToolTip(programView.UpcomingRecording, "on"); } else if (programView.ActiveRecording != null && programView.CancellationReason == UpcomingCancellationReason.None) { row.Cells[2].ToolTipText = ProcessUtility.BuildRecordingInfoToolTip(programView.ActiveRecording, "on"); } else { row.Cells[2].ToolTipText = null; } } row.Cells[0].Value = icon; row.Cells[0].ToolTipText = toolTip; } }
private static void PlayRecording(UpcomingOrActiveProgramView upcomingProgramView) { if (upcomingProgramView != null && upcomingProgramView.ActiveRecording != null) { WinFormsUtility.RunVlc(upcomingProgramView.ActiveRecording.RecordingFileName); } }
private UpcomingOrActiveProgramView GetSelectedUpcomingProgramView() { UpcomingOrActiveProgramView upcomingProgramView = null; if (_upcomingProgramsControl.SelectedRows.Count > 0) { upcomingProgramView = _upcomingProgramsControl.SelectedRows[0].DataBoundItem as UpcomingOrActiveProgramView; } return(upcomingProgramView); }
private ActiveRecording GetSelectedActiveRecording() { ActiveRecording activeRecording = null; if (_activeRecordingsControl.SelectedRows.Count > 0) { UpcomingOrActiveProgramView upcomingProgramView = _activeRecordingsControl.SelectedRows[0].DataBoundItem as UpcomingOrActiveProgramView; if (upcomingProgramView != null) { activeRecording = upcomingProgramView.ActiveRecording; } } return(activeRecording); }
private void _upcomingProgramsControl_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo htinfo = _upcomingProgramsControl.HitTest(e.X, e.Y); if (htinfo.Type == DataGridViewHitTestType.Cell) { UpcomingOrActiveProgramView upcomingProgramView = _upcomingProgramsControl.Rows[htinfo.RowIndex].DataBoundItem as UpcomingOrActiveProgramView; if (upcomingProgramView != null && upcomingProgramView.ActiveRecording != null) { _upcomingProgramsControl.Rows[htinfo.RowIndex].Selected = true; _programContextMenuStrip.SetTarget(upcomingProgramView.ActiveRecording); _programContextMenuStrip.Show(_upcomingProgramsControl, e.Location); } } } }
private void _activeRecordingsControl_GridMouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo htinfo = _activeRecordingsControl.HitTest(e.X, e.Y); if (htinfo.Type == DataGridViewHitTestType.Cell) { UpcomingOrActiveProgramView upcomingProgramView = _activeRecordingsControl.Rows[htinfo.RowIndex].DataBoundItem as UpcomingOrActiveProgramView; if (upcomingProgramView != null) { _playRecordingToolStripMenuItem.Enabled = Utility.IsVlcInstalled(); _activeRecordingsControl.Rows[htinfo.RowIndex].Selected = true; _programContextMenuStrip.Show(_activeRecordingsControl, e.Location); } else { _playRecordingToolStripMenuItem.Enabled = false; } } } }