Example #1
0
 private void OnChangePriority(UpcomingProgram upcoming)
 {
     if (upcoming != null)
     {
         GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
         if (dlg != null)
         {
             dlg.Reset();
             dlg.SetHeading(Utility.GetLocalizedText(TextId.Priority));
             dlg.Add(Utility.GetLocalizedText(TextId.VeryLow));
             dlg.Add(Utility.GetLocalizedText(TextId.Low));
             dlg.Add(Utility.GetLocalizedText(TextId.Normal));
             dlg.Add(Utility.GetLocalizedText(TextId.High));
             dlg.Add(Utility.GetLocalizedText(TextId.VeryHigh));
             dlg.Add(Utility.GetLocalizedText(TextId.Highest));
             dlg.Add(Utility.GetLocalizedText(TextId.ResetToSchedulePriority));
             dlg.SelectedLabel = (int)upcoming.Priority + 2;
             dlg.DoModal(GetID);
             if (dlg.SelectedLabel >= 0)
             {
                 int selectedInt = dlg.SelectedLabel - 2;
                 UpcomingProgramPriority?priority = null;
                 if (selectedInt >= (int)UpcomingProgramPriority.VeryLow &&
                     selectedInt <= (int)UpcomingProgramPriority.Highest)
                 {
                     priority = (UpcomingProgramPriority)selectedInt;
                 }
                 Proxies.SchedulerService.SetUpcomingProgramPriority(upcoming.UpcomingProgramId, upcoming.StartTime, priority).Wait();
                 m_iSelectedItem = GetSelectedItemNo();
                 LoadUpcomingPrograms(null);
             }
         }
     }
 }
Example #2
0
 private bool OnEditSchedule(UpcomingProgram upcoming)
 {
     if (upcoming != null)
     {
         Schedule sched = Proxies.SchedulerService.GetScheduleById(upcoming.ScheduleId).Result;
         if (sched != null)
         {
             if (upcoming.GuideProgramId.HasValue && sched.Rules.FindRuleByType(ScheduleRuleType.ManualSchedule) == null)
             {
                 TvProgramInfo.CurrentProgram = Proxies.GuideService.GetProgramById(upcoming.GuideProgramId.Value).Result;
                 TvProgramInfo.Channel        = upcoming.Channel;
                 GUIWindowManager.ActivateWindow((int)WindowId.ProgramInfo);
                 return(true);
             }
             else if (sched.Rules.FindRuleByType(ScheduleRuleType.ManualSchedule) != null)
             {
                 ManualSchedule.channelType     = upcoming.Channel.ChannelType;
                 ManualSchedule.upcomingProgram = upcoming;
                 GUIWindowManager.ActivateWindow((int)WindowId.ManualShedule);
                 return(true);
             }
         }
     }
     return(false);
 }
Example #3
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);
                    }
                }
            }
        }
Example #4
0
        private bool BroadcastAlert(AddressList alertContactFilter, UpcomingProgram upcomingAlert)
        {
            bool result = false;

            if (_messenger.Nameserver.IsSignedIn)
            {
                foreach (Contact contact in _messenger.ContactList.Allowed)
                {
                    if (!alertContactFilter.ContainsAddress(contact.Account) &&
                        BroadcastingAllowed(contact.Status))
                    {
                        StringBuilder text = new StringBuilder();
                        if (upcomingAlert.StartTime > DateTime.Now)
                        {
                            text.AppendLine("ALERT! This program is about to start:");
                        }
                        else
                        {
                            text.AppendLine("ALERT! This program has already started:");
                        }
                        Utility.AppendProgramDetails(text, upcomingAlert.Channel, upcomingAlert);

                        if (result)
                        {
                            // We just sent out an alert, seems this is needed to give the system
                            // some extra time :-(
                            Thread.Sleep(100);
                        }
                        BroadcastMessage(contact, text.ToString());
                        result = true;
                    }
                }
            }
            return(result);
        }
Example #5
0
        public static string CreateConflictingProgramsToolTip(UpcomingOrActiveProgramsList upcomingRecordings, List <Guid> programIds,
                                                              string conflictsText, string noCardFoundText)
        {
            StringBuilder toolTip = new StringBuilder();

            foreach (Guid programId in programIds)
            {
                if (toolTip.Length > 0)
                {
                    toolTip.AppendLine();
                }
                else
                {
                    toolTip.AppendLine(conflictsText);
                }
                UpcomingProgram upcomingProgram = upcomingRecordings.FindProgramById(programId);
                if (upcomingProgram != null)
                {
                    toolTip.AppendFormat("● {0} {1:g}-{2:t} {3}", upcomingProgram.Channel.DisplayName,
                                         upcomingProgram.StartTime, upcomingProgram.StopTime, upcomingProgram.CreateProgramTitle());
                }
                else
                {
                    toolTip.Append("● ?");
                }
            }
            if (toolTip.Length == 0)
            {
                toolTip.Append(noCardFoundText);
            }
            return(toolTip.ToString());
        }
Example #6
0
        protected override void OnShowContextMenu()
        {
            int         itemIndex = GetSelectedItemNo();
            GUIListItem item      = GetItem(itemIndex);

            if (item == null ||
                item.IsFolder)
            {
                return;
            }
            UpcomingProgram program = item.TVTag as UpcomingProgram;

            if (program != null)
            {
                GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }
                dlg.Reset();
                dlg.SetHeading(program.Title);
                dlg.Add(Utility.GetLocalizedText(TextId.Information));
                dlg.DoModal(GetID);
                switch (dlg.SelectedLabel)
                {
                case 0:     // information
                    OnEditSchedule(program);
                    break;
                }
            }
        }
Example #7
0
        public static string BuildRecordingBaseFileName(string recordingsPath, UpcomingProgram program)
        {
            StringBuilder filePath = new StringBuilder();

            if (recordingsPath != null)
            {
                filePath.Append(recordingsPath);
                if (filePath[filePath.Length - 1] != Path.DirectorySeparatorChar)
                {
                    filePath.Append(Path.DirectorySeparatorChar);
                }
                filePath.Append(MakeValidFileName(program.Title)).Append(Path.DirectorySeparatorChar);
            }
            string programTitle = program.CreateProgramTitle();

            if (programTitle.Length > 80)
            {
                programTitle = programTitle.Substring(0, 80);
            }
            filePath.Append(MakeValidFileName(programTitle));
            filePath.Append("_");
            filePath.AppendFormat(MakeValidFileName(program.Channel.DisplayName));
            filePath.Append("_");
            filePath.AppendFormat(CultureInfo.InvariantCulture, @"{0:yyyy-MM-dd_HH-mm}", program.StartTime);
            return(filePath.ToString());
        }
        /// <summary>
        /// Remove an upcoming program from the list of previously recorded programs of its schedule. This list is the one used
        /// to make the NewEpisodesOnly and NewTitlesOnly rules work.
        /// </summary>
        /// <param name="upcomingProgram">The upcoming program to remove from the history.</param>
        public async Task RemoveFromPreviouslyRecordedHistory(UpcomingProgram upcomingProgram)
        {
            var request = NewRequest(HttpMethod.Post, "RemoveFromPreviouslyRecordedHistory");

            request.AddBody(upcomingProgram);
            await ExecuteAsync(request).ConfigureAwait(false);
        }
Example #9
0
        private GUIListItem CreateListItem(UpcomingProgram program, bool isFolder)
        {
            GUIListItem item = new GUIListItem();

            item.IsFolder = isFolder;
            item.TVTag    = program;
            return(item);
        }
 public RecordingThread(Guid recorderTunerId, string serverHostName, int tcpPort, CardChannelAllocation channelAllocation,
                        DateTime startTimeUtc, DateTime stopTimeUtc, UpcomingProgram recordingProgram, string suggestedBaseFileName,
                        TvDatabase.Card recordOnCard, TvDatabase.Channel channel)
     : base(recorderTunerId, serverHostName, tcpPort, channelAllocation, startTimeUtc, stopTimeUtc, recordingProgram, true)
 {
     _suggestedBaseFileName = suggestedBaseFileName;
     _recordOnCard          = recordOnCard;
     _channel = channel;
 }
Example #11
0
 public RecordingThread(Guid recorderId, string schedulerBaseUrl, CardChannelAllocation channelAllocation,
                        DateTime startTimeUtc, DateTime stopTimeUtc, UpcomingProgram recordingProgram, string suggestedBaseFileName,
                        TvDatabase.Card recordOnCard, TvDatabase.Channel channel)
     : base(recorderId, schedulerBaseUrl, channelAllocation, startTimeUtc, stopTimeUtc, recordingProgram, true)
 {
     _suggestedBaseFileName = suggestedBaseFileName;
     _recordOnCard          = recordOnCard;
     _channel = channel;
 }
 public override bool AbortRecording(string schedulerBaseUrl, UpcomingProgram recordingProgram)
 {
     Log("{0} - Abort recording {1}", this.Name, recordingProgram.CreateProgramTitle());
     if (!_recordingThreads.StopThreadAsync(recordingProgram))
     {
         Log(TraceEventType.Warning, "{0} - Recording {1} not found, failed to abort", this.Name, recordingProgram.CreateProgramTitle());
         return(false);
     }
     return(true);
 }
Example #13
0
        private void SetProperties(UpcomingProgram upcoming, ScheduleSummary schedule)
        {
            string guiPropertyPrefix = this._channelType == ChannelType.Television ? "#TV" : "#Radio";

            if (schedule != null)
            {
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", schedule.Name);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", " ");
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", "defaultFolderBig.png");
            }
            else if (upcoming != null)
            {
                GuideProgram guideProgram = upcoming.GuideProgramId.HasValue ?
                                            Proxies.GuideService.GetProgramById(upcoming.GuideProgramId.Value).Result : null;

                string strTime = string.Format("{0} {1} - {2}",
                                               Utility.GetShortDayDateString(upcoming.StartTime),
                                               upcoming.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                               upcoming.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", upcoming.Channel.DisplayName);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", upcoming.Title);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", upcoming.Category);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", strTime);

                string description = String.Empty;
                if (guideProgram != null)
                {
                    description = guideProgram.CreateCombinedDescription(true);
                }
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", description);

                string logo = Utility.GetLogoImage(upcoming.Channel.ChannelId, upcoming.Channel.DisplayName);
                if (!string.IsNullOrEmpty(logo))
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", logo);
                }
                else
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", "defaultVideoBig.png");
                }
            }
            else
            {
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", " ");
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", String.Empty);
            }
        }
Example #14
0
 private bool NotifyProgram(UpcomingProgram program)
 {
     lock (this)
     {
         GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM, 0, 0, 0, 0, 0, null);
         msg.Object = program;
         GUIGraphicsContext.SendMessage(msg);
         msg = null;
         return(true);
     }
 }
Example #15
0
        /// <summary>
        /// Tell the recorder to abort the recording of a program.  The implementation must call
        /// /Recording/End on the Recorder callback service.
        /// </summary>
        /// <param name="schedulerBaseUrl">The callback URL for the Recorder to communicate with the Scheduler.</param>
        /// <param name="recordingProgram">The program that is being recorded.</param>
        /// <returns>True if the recording was found and aborted.</returns>
        public async Task <bool> AbortRecording(string schedulerBaseUrl, UpcomingProgram recordingProgram)
        {
            var request = NewRequest(HttpMethod.Put, "Recording/Abort");

            request.AddBody(new
            {
                schedulerBaseUrl = schedulerBaseUrl,
                recordingProgram = recordingProgram
            });
            return(await ExecuteResult <bool>(request).ConfigureAwait(false));
        }
Example #16
0
        /// <summary>
        /// Tell the recorder to abort the recording of a program.  The implementation must call
        /// /Recording/End on the Recorder callback service.
        /// </summary>
        /// <param name="schedulerBaseUrl">The callback URL for the Recorder to communicate with the Scheduler.</param>
        /// <param name="recordingProgram">The program that is being recorded.</param>
        /// <returns>True if the recording was found and aborted.</returns>
        public bool AbortRecording(string schedulerBaseUrl, UpcomingProgram recordingProgram)
        {
            var request = NewRequest("/Recording/Abort", Method.PUT);

            request.AddBody(new
            {
                schedulerBaseUrl = schedulerBaseUrl,
                recordingProgram = recordingProgram
            });
            return(ExecuteResult <bool>(request));
        }
Example #17
0
 private bool OnEditSchedule(UpcomingProgram program)
 {
     if (program != null)
     {
         TvProgramInfo.CurrentProgram = _tvGuideAgent.GetProgramById(program.GuideProgramId.Value);
         TvProgramInfo.Channel        = program.Channel;
         GUIWindowManager.ActivateWindow((int)WindowId.ProgramInfo);
         return(true);
     }
     return(false);
 }
Example #18
0
 public RecordingThreadBase(Guid recorderId, string schedulerBaseUrl, CardChannelAllocation channelAllocation,
                            DateTime startTimeUtc, DateTime stopTimeUtc, UpcomingProgram recordingProgram, bool okToRenameRecordedFiles)
     : base("Record")
 {
     _recorderId              = recorderId;
     _schedulerBaseUrl        = schedulerBaseUrl;
     _channelAllocation       = channelAllocation;
     _startTimeUtc            = startTimeUtc;
     _stopTimeUtc             = stopTimeUtc;
     _recordingProgram        = recordingProgram;
     _okToRenameRecordedFiles = okToRenameRecordedFiles;
 }
        public async Task AddNewRecording(UpcomingProgram recordingProgram, DateTime recordingStartTimeUtc, string recordingFileName)
        {
            var request = NewRequest(HttpMethod.Post, "RecorderCallback/Recording/New");

            request.AddBody(new
            {
                RecordingProgram      = recordingProgram,
                RecordingStartTimeUtc = recordingStartTimeUtc,
                RecordingFileName     = recordingFileName
            });
            await ExecuteAsync(request).ConfigureAwait(false);
        }
Example #20
0
 public void AddRemoveHistoryUpcomingProgram(UpcomingProgram upcomingProgram, bool addToHistory)
 {
     if (addToHistory)
     {
         Proxies.ControlService.AddToPreviouslyRecordedHistory(upcomingProgram).Wait();
     }
     else
     {
         Proxies.ControlService.RemoveFromPreviouslyRecordedHistory(upcomingProgram).Wait();
     }
     RefreshUpcomingPrograms();
 }
Example #21
0
        public void AddNewRecording(UpcomingProgram recordingProgram, DateTime recordingStartTimeUtc, string recordingFileName)
        {
            var request = NewRequest("/RecorderCallback/Recording/New", Method.POST);

            request.AddBody(new
            {
                RecordingProgram      = recordingProgram,
                RecordingStartTimeUtc = recordingStartTimeUtc,
                RecordingFileName     = recordingFileName
            });
            Execute(request);
        }
Example #22
0
        public void StartRecordingFailed(CardChannelAllocation channelAllocation, UpcomingProgram recordingProgram, string reason)
        {
            var request = NewRequest("/RecorderCallback/Recording/StartFailed", Method.PUT);

            request.AddBody(new
            {
                Allocation       = channelAllocation,
                RecordingProgram = recordingProgram,
                Reason           = reason
            });
            Execute(request);
        }
Example #23
0
 public void AddRemoveHistoryUpcomingProgram(ISchedulerService tvSchedulerAgent, IControlService tvControlAgent,
                                             UpcomingProgram upcomingProgram, bool addToHistory)
 {
     if (addToHistory)
     {
         tvControlAgent.AddToPreviouslyRecordedHistory(upcomingProgram);
     }
     else
     {
         tvControlAgent.RemoveFromPreviouslyRecordedHistory(upcomingProgram);
     }
     RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
 }
Example #24
0
 public RecordingThreadBase(Guid recorderTunerId, string serverHostName, int serverTcpPort, CardChannelAllocation channelAllocation,
                            DateTime startTimeUtc, DateTime stopTimeUtc, UpcomingProgram recordingProgram, bool okToRenameRecordedFiles)
     : base("Record")
 {
     _recorderTunerId         = recorderTunerId;
     _serverHostName          = serverHostName;
     _serverTcpPort           = serverTcpPort;
     _channelAllocation       = channelAllocation;
     _startTimeUtc            = startTimeUtc;
     _stopTimeUtc             = stopTimeUtc;
     _recordingProgram        = recordingProgram;
     _okToRenameRecordedFiles = okToRenameRecordedFiles;
 }
 private void SetTarget(Channel channel, Guid?guideProgramId, string title, string subTitle, string episodeNumberDisplay, DateTime startTime,
                        ScheduleType?scheduleType, UpcomingProgram upcomingProgram, UpcomingGuideProgram upcomingGuideProgram, ActiveRecording activeRecording)
 {
     _channel              = channel;
     _guideProgramId       = guideProgramId;
     _title                = title;
     _subTitle             = subTitle;
     _episodeNumberDisplay = episodeNumberDisplay;
     _startTime            = startTime;
     _scheduleType         = scheduleType;
     _upcomingProgram      = upcomingProgram;
     _activeRecording      = activeRecording;
     _upcomingGuideProgram = upcomingGuideProgram;
 }
Example #26
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);
                        }
                    }
                }
            }
        }
Example #27
0
        public void RemoveUpcomingProgram(Guid scheduleId, Guid?guideProgramId, Guid channelId, DateTime startTime)
        {
            UpcomingOrActiveProgramsList upcomingProgramsList = _upcomingProgramsListBindingSource.DataSource as UpcomingOrActiveProgramsList;

            foreach (UpcomingOrActiveProgramView upcomingView in upcomingProgramsList)
            {
                UpcomingProgram upcomingProgram = upcomingView.UpcomingProgram;
                if (upcomingProgram.ScheduleId == scheduleId &&
                    upcomingProgram.Channel.ChannelId == channelId &&
                    upcomingProgram.GuideProgramId == guideProgramId &&
                    upcomingProgram.StartTime == startTime)
                {
                    upcomingProgramsList.Remove(upcomingView);
                    break;
                }
            }
            _upcomingProgramsListBindingSource.ResetBindings(false);
        }
 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)
             {
                 UpcomingProgram upcomingProgram = upcomingProgramView.UpcomingProgram;
                 _upcomingProgramsControl.Rows[htinfo.RowIndex].Selected = true;
                 _programContextMenuStrip.SetTarget(_scheduleType, upcomingProgram);
                 _programContextMenuStrip.Show(_upcomingProgramsControl, e.Location);
             }
         }
     }
 }
Example #29
0
        public void RemoveUpcomingProgramsForSchedule(Guid scheduleId)
        {
            UpcomingOrActiveProgramsList       upcomingProgramsList = _upcomingProgramsListBindingSource.DataSource as UpcomingOrActiveProgramsList;
            List <UpcomingOrActiveProgramView> toRemove             = new List <UpcomingOrActiveProgramView>();

            foreach (UpcomingOrActiveProgramView upcomingView in upcomingProgramsList)
            {
                UpcomingProgram upcomingProgram = upcomingView.UpcomingProgram;
                if (upcomingProgram.ScheduleId == scheduleId)
                {
                    toRemove.Add(upcomingView);
                }
            }
            foreach (UpcomingOrActiveProgramView upcomingView in toRemove)
            {
                upcomingProgramsList.Remove(upcomingView);
            }
            _upcomingProgramsListBindingSource.ResetBindings(false);
        }
Example #30
0
        private void UpdateProperties()
        {
            GUIListItem pItem = GetItem(GetSelectedItemNo());

            if (pItem == null)
            {
                SetProperties(null, null);
                return;
            }

            if (!pItem.IsFolder)
            {
                UpcomingProgram upcoming = pItem.TVTag as UpcomingProgram;
                SetProperties(upcoming, null);
            }
            else
            {
                ScheduleSummary schedule = pItem.TVTag as ScheduleSummary;
                SetProperties(null, schedule);
            }
        }