private void _tvChannelProgramsControl_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo htinfo = _tvChannelProgramsControl.HitTest(e.X, e.Y); if (htinfo.Type == DataGridViewHitTestType.Cell) { ChannelProgramView programView = _tvChannelProgramsControl.Rows[htinfo.RowIndex].DataBoundItem as ChannelProgramView; if (programView != null) { GuideUpcomingProgram upcomingProgramInfo = null; _model.AllUpcomingGuidePrograms.TryGetValue(programView.UpcomingProgramId, out upcomingProgramInfo); _tvChannelProgramsControl.Rows[htinfo.RowIndex].Selected = true; ScheduleType? scheduleType = null; UpcomingProgram upcomingProgram = null; UpcomingGuideProgram upcomingGuideProgram = null; if (upcomingProgramInfo != null && upcomingProgramInfo.ChannelId == programView.Program.Channel.ChannelId) { scheduleType = upcomingProgramInfo.Type; upcomingProgram = upcomingProgramInfo.UpcomingRecording != null ? upcomingProgramInfo.UpcomingRecording.Program : null; upcomingGuideProgram = upcomingProgramInfo.UpcomingGuideProgram; } _programContextMenuStrip.SetTarget(programView.Program.Channel, programView.Program.GuideProgramId, programView.Title, programView.SubTitle, programView.EpisodeNumberDisplay, programView.StartTime, scheduleType, upcomingProgram, upcomingGuideProgram); _programContextMenuStrip.Show(_tvChannelProgramsControl, e.Location); } } } }
private ChannelProgram GetSelectedProgram() { ChannelProgramView tvChannelProgramView = null; if (_tvChannelProgramsControl.SelectedRows.Count > 0) { tvChannelProgramView = _tvChannelProgramsControl.SelectedRows[0].DataBoundItem as ChannelProgramView; } return(tvChannelProgramView == null ? null : tvChannelProgramView.Program); }
private void _programsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 3 && e.RowIndex >= 0 && e.RowIndex < _programsDataGridView.Rows.Count) { ChannelProgramView programView = _programsDataGridView.Rows[e.RowIndex].DataBoundItem as ChannelProgramView; GuideProgram guideProgram = Proxies.GuideService.GetProgramById(programView.Program.GuideProgramId).Result; using (ProgramDetailsPopup popup = new ProgramDetailsPopup()) { popup.Channel = programView.Program.Channel; popup.GuideProgram = guideProgram; Point location = Cursor.Position; location.Offset(-250, -40); popup.Location = location; popup.ShowDialog(this); } } }
public void RefreshIcons() { foreach (DataGridViewRow row in _programsDataGridView.Rows) { Icon icon = Properties.Resources.TransparentIcon; string toolTip = null; ChannelProgramView programView = row.DataBoundItem as ChannelProgramView; if (programView != null) { if (_allUpcomingPrograms.ContainsKey(programView.UpcomingProgramId)) { GuideUpcomingProgram programInfo = _allUpcomingPrograms[programView.UpcomingProgramId]; ArgusTV.WinForms.ProgramIconUtility.GetIconAndToolTip(programInfo.Type, programInfo.CancellationReason, programInfo.IsPartOfSeries, _allUpcomingPrograms.UpcomingRecordings, programInfo.UpcomingRecording, out icon, out toolTip); } } row.Cells[0].Value = icon; row.Cells[0].ToolTipText = toolTip; } }