Beispiel #1
0
        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);
                    }
                }
            }
        }
Beispiel #2
0
        private void _channelsGridView_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                DataGridView.HitTestInfo htinfo = _channelsGridView.HitTest(e.X, e.Y);
                if (htinfo.Type == DataGridViewHitTestType.Cell)
                {
                    CurrentAndNextProgramView programView = _channelsGridView.Rows[htinfo.RowIndex].DataBoundItem as CurrentAndNextProgramView;
                    if (programView != null)
                    {
                        GuideProgramSummary guideProgram = null;
                        if (htinfo.ColumnIndex == ColumnIndex.CurrentIcon ||
                            htinfo.ColumnIndex == ColumnIndex.CurrentTitle)
                        {
                            guideProgram = programView.CurrentAndNextProgram.Current;
                        }
                        else if (htinfo.ColumnIndex == ColumnIndex.NextIcon ||
                                 htinfo.ColumnIndex == ColumnIndex.NextTitle)
                        {
                            guideProgram = programView.CurrentAndNextProgram.Next;
                        }
                        if (guideProgram != null)
                        {
                            Guid upcomingProgramId = guideProgram.GetUniqueUpcomingProgramId(programView.CurrentAndNextProgram.Channel.ChannelId);

                            GuideUpcomingProgram upcomingProgramInfo = null;
                            _allUpcomingGuidePrograms.TryGetValue(upcomingProgramId, out upcomingProgramInfo);

                            _channelsGridView.Rows[htinfo.RowIndex].Selected = true;

                            ScheduleType?        scheduleType         = null;
                            UpcomingProgram      upcomingProgram      = null;
                            UpcomingGuideProgram upcomingGuideProgram = null;
                            if (upcomingProgramInfo != null)
                            {
                                scheduleType         = upcomingProgramInfo.Type;
                                upcomingProgram      = upcomingProgramInfo.UpcomingRecording != null ? upcomingProgramInfo.UpcomingRecording.Program : null;
                                upcomingGuideProgram = upcomingProgramInfo.UpcomingGuideProgram;
                            }

                            _programContextMenuStrip.SetTarget(programView.CurrentAndNextProgram.Channel, guideProgram.GuideProgramId,
                                                               guideProgram.Title, guideProgram.SubTitle, guideProgram.EpisodeNumberDisplay, guideProgram.StartTime,
                                                               scheduleType, upcomingProgram, upcomingGuideProgram);
                            _programContextMenuStrip.Show(_channelsGridView, e.Location);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void SetCellIcon(DataGridViewRow row, int columnIndex, Channel channel, Guid?upcomingProgramId)
        {
            Icon   icon    = Properties.Resources.TransparentIcon;
            string toolTip = null;

            if (upcomingProgramId.HasValue &&
                _allUpcomingGuidePrograms.ContainsKey(upcomingProgramId.Value))
            {
                GuideUpcomingProgram programInfo = _allUpcomingGuidePrograms[upcomingProgramId.Value];

                ProgramIconUtility.GetIconAndToolTip(programInfo.Type, programInfo.CancellationReason, programInfo.IsPartOfSeries,
                                                     _allUpcomingGuidePrograms.UpcomingRecordings, programInfo.UpcomingRecording, out icon, out toolTip);
            }
            row.Cells[columnIndex].Value       = icon;
            row.Cells[columnIndex].ToolTipText = toolTip;
        }
        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;
            }
        }
Beispiel #5
0
        private void SetLabels()
        {
            UpcomingRecording[]             upcomingRecordings       = ControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true);
            UpcomingGuideProgram[]          upcomingAlerts           = SchedulerAgent.GetUpcomingGuidePrograms(ScheduleType.Alert, true);
            UpcomingGuideProgram[]          upcomingSuggestions      = SchedulerAgent.GetUpcomingGuidePrograms(ScheduleType.Suggestion, true);
            UpcomingGuideProgramsDictionary AllUpcomingGuidePrograms = new UpcomingGuideProgramsDictionary(upcomingRecordings, upcomingAlerts, upcomingSuggestions);

            foreach (GUIListItem item in _viewsList.ListItems)
            {
                if (item.Label != _parentDirectoryLabel)
                {
                    UpcomingProgram program = item.TVTag as UpcomingProgram;
                    if (program != null)
                    {
                        if (!item.IsFolder)
                        {
                            item.PinImage = null;
                            Guid upcomingProgramId = program.UpcomingProgramId;
                            if (AllUpcomingGuidePrograms.ContainsKey(upcomingProgramId))
                            {
                                GuideUpcomingProgram programInfo = AllUpcomingGuidePrograms[upcomingProgramId];
                                item.PinImage = Utility.GetIconImageFileName(programInfo.Type, programInfo.IsPartOfSeries,
                                                                             programInfo.CancellationReason, programInfo.UpcomingRecording);
                            }

                            string title = GuideProgram.CreateProgramTitle(program.Title, program.SubTitle, program.EpisodeNumberDisplay);
                            item.Label = title;
                            string logoImagePath = Utility.GetLogoImage(program.Channel, _tvSchedulerAgent);
                            if (logoImagePath == null ||
                                !System.IO.File.Exists(logoImagePath))
                            {
                                item.Label    = String.Format("[{0}] {1}", program.Channel.DisplayName, title);
                                logoImagePath = "defaultVideoBig.png";
                            }

                            item.ThumbnailImage = logoImagePath;
                            item.IconImageBig   = logoImagePath;
                            item.IconImage      = logoImagePath;

                            item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(program.StartTime),
                                                        program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                        program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                            if (_currentSortMethod == SortMethod.Channel)
                            {
                                item.Label3 = program.Channel.DisplayName;
                            }
                            else
                            {
                                item.Label3 = program.Category;
                            }
                        }
                        else
                        {
                            Utils.SetDefaultIcons(item);
                            item.Label = program.Title;
                        }
                    }
                }
            }
            AllUpcomingGuidePrograms.Clear();
            AllUpcomingGuidePrograms = null;
        }
Beispiel #6
0
 internal static string GetIconImageFileName(ScheduleType scheduleType, GuideUpcomingProgram upcoming)
 {
     return(GetIconImageFileName(scheduleType, upcoming.IsPartOfSeries, upcoming.CancellationReason, upcoming.UpcomingRecording));
 }