コード例 #1
0
ファイル: EpgControl.cs プロジェクト: Christoph21x/ARGUS-TV
 public ProgramEventArgs(GuideProgramSummary guideProgram, Channel channel, Point location)
 {
     this.GuideProgram = guideProgram;
     this.Channel = channel;
     this.Location = location;
     this.UpcomingProgramId = guideProgram.GetUniqueUpcomingProgramId(channel.ChannelId);
 }
コード例 #2
0
 internal void InsertProgram(GuideProgramSummary guideProgram)
 {
     if (!_programs.ContainsKey(guideProgram.StartTime)
         && !ContainsProgram(guideProgram.GuideProgramId))
     {
         _programs.Add(guideProgram.StartTime, guideProgram);
     }
 }
コード例 #3
0
 public ChannelPrograms(DateTime lowerBoundTime, DateTime upperBoundTime, GuideProgramSummary[] guidePrograms)
 {
     _lowerBoundTime = lowerBoundTime;
     _upperBoundTime = upperBoundTime;
     _programs = new SortedList<DateTime, GuideProgramSummary>();
     foreach (GuideProgramSummary guideProgram in guidePrograms)
     {
         // Normally this should not happen, but in case there's bad guide data and two programs start at
         // the same time, let's make sure we only display one of them.
         if (!_programs.ContainsKey(guideProgram.StartTime))
         {
             _programs.Add(guideProgram.StartTime, guideProgram);
         }
     }
 }
コード例 #4
0
ファイル: GuideBase.cs プロジェクト: Christoph21x/ARGUS-TV
 private bool IsRunningAt(GuideProgramSummary program, DateTime time)
 {
     return (time >= program.StartTime && time <= program.StopTime);
 }
コード例 #5
0
ファイル: GuideBase.cs プロジェクト: Christoph21x/ARGUS-TV
 private bool IsRunningAt(GuideProgramSummary program, DateTime fromTime, DateTime toTime)
 {
     return (fromTime < program.StopTime && toTime > program.StartTime);
 }
コード例 #6
0
ファイル: GuideBase.cs プロジェクト: Christoph21x/ARGUS-TV
 /// <summary>
 /// returns true if Mediaportal should send a notification when the program specified is about to start
 /// </summary>
 /// <param name="program">Program</param>
 /// <returns>true : MP shows a notification when program is about to start</returns>
 private bool ShouldNotifyProgram(GuideProgramSummary program)
 {
     return false;
 }
コード例 #7
0
ファイル: GuideBase.cs プロジェクト: Christoph21x/ARGUS-TV
        private void RenderChannel(int iChannel, GuideBaseChannel tvGuideChannel, long iStart, long iEnd, bool selectCurrentShow)
        {
            Channel channel = tvGuideChannel.channel;
            int channelNum = 0;

            if (!_byIndex)
            {
                if (channel.LogicalChannelNumber.HasValue)
                {
                    channelNum = channel.LogicalChannelNumber.Value;
                }
            }
            else
            {
                channelNum = _channelList.IndexOf(tvGuideChannel) + 1;
            }

            GUIButton3PartControl img = GetControl(iChannel + (int)Controls.IMG_CHAN1) as GUIButton3PartControl;
            if (img != null)
            {
                if (_showChannelLogos)
                {
                    img.TexutureIcon = tvGuideChannel.strLogo;
                }
                if (channelNum > 0 && _showChannelNumber)
                {
                    img.Label1 = channelNum + " " + channel.DisplayName;
                }
                else
                {
                    img.Label1 = channel.DisplayName;
                }
                img.Data = channel;
                img.IsVisible = true;
            }

            IList<GuideProgramSummary> programs = new List<GuideProgramSummary>();
            if (_model.ProgramsByChannel.ContainsKey(channel.ChannelId))
            {
                programs = _model.ProgramsByChannel[channel.ChannelId].Programs;
            }

            bool noEPG = (programs == null || programs.Count == 0);
            if (noEPG)
            {
                DateTime dt = Utils.longtodate(iEnd);
                long iProgEnd = Utils.datetolong(dt);
                GuideProgramSummary prog = new GuideProgramSummary()
                {
                    GuideChannelId = channel.GuideChannelId.HasValue ? channel.GuideChannelId.Value : Guid.Empty,
                    StartTime = Utils.longtodate(iStart),
                    StopTime = Utils.longtodate(iProgEnd),
                    Title = Utility.GetLocalizedText(TextId.NoDataAvailable),
                    SubTitle = String.Empty,
                    Category = String.Empty
                };
                programs = new List<GuideProgramSummary>();
                programs.Add(prog);
            }

            int iProgram = 0;
            int iPreviousEndXPos = 0;

            int width = GetControl((int)Controls.LABEL_TIME1 + 1).XPosition;
            width -= GetControl((int)Controls.LABEL_TIME1).XPosition;

            int height = GetControl((int)Controls.IMG_CHAN1 + 1).YPosition;
            height -= GetControl((int)Controls.IMG_CHAN1).YPosition;

            foreach (GuideProgramSummary program in programs)
            {
                if (Utils.datetolong(program.StopTime) <= iStart
                    || Utils.datetolong(program.StartTime) >= iEnd)
                    continue;

                string strTitle = program.Title;
                bool bStartsBefore = false;
                bool bEndsAfter = false;

                if (Utils.datetolong(program.StartTime) < iStart)
                    bStartsBefore = true;

                if (Utils.datetolong(program.StopTime) > iEnd)
                    bEndsAfter = true;

                DateTime dtBlokStart = new DateTime();
                dtBlokStart = _viewingTime;
                dtBlokStart = dtBlokStart.AddMilliseconds(-dtBlokStart.Millisecond);
                dtBlokStart = dtBlokStart.AddSeconds(-dtBlokStart.Second);

                bool isAlert;
                bool isRecording;
                string recordIconImage = GetChannelProgramIcon(channel, program.GuideProgramId, out isRecording,out isAlert);

                if (noEPG && !isRecording)
                {
                    ActiveRecording rec;
                    isRecording = PluginMain.IsChannelRecording(channel.ChannelId, out rec);
                }

                bool bProgramIsHD = (program.Flags & GuideProgramFlags.HighDefinition) != 0;

                int iStartXPos = 0;
                int iEndXPos = 0;
                for (int iBlok = 0; iBlok < _numberOfBlocks; iBlok++)
                {
                    float fWidthEnd = (float)width;
                    DateTime dtBlokEnd = dtBlokStart.AddMinutes(_timePerBlock - 1);
                    if (IsRunningAt(program, dtBlokStart, dtBlokEnd))
                    {
                        //dtBlokEnd = dtBlokStart.AddSeconds(_timePerBlock * 60);
                        if (program.StopTime <= dtBlokEnd)
                        {
                            TimeSpan dtSpan = dtBlokEnd - program.StopTime;
                            int iEndMin = _timePerBlock - (dtSpan.Minutes);

                            fWidthEnd = (((float)iEndMin) / ((float)_timePerBlock)) * ((float)(width));
                            if (bEndsAfter)
                            {
                                fWidthEnd = (float)width;
                            }
                        }

                        if (iStartXPos == 0)
                        {
                            TimeSpan ts = program.StartTime - dtBlokStart;
                            int iStartMin = ts.Hours * 60;
                            iStartMin += ts.Minutes;
                            if (ts.Seconds == 59)
                            {
                                iStartMin += 1;
                            }
                            float fWidth = (((float)iStartMin) / ((float)_timePerBlock)) * ((float)(width));

                            if (bStartsBefore)
                            {
                                fWidth = 0;
                            }

                            iStartXPos = GetControl(iBlok + (int)Controls.LABEL_TIME1).XPosition;
                            iStartXPos += (int)fWidth;
                            iEndXPos = GetControl(iBlok + (int)Controls.LABEL_TIME1).XPosition + (int)fWidthEnd;
                        }
                        else
                        {
                            iEndXPos = GetControl(iBlok + (int)Controls.LABEL_TIME1).XPosition + (int)fWidthEnd;
                        }
                    }
                    dtBlokStart = dtBlokStart.AddMinutes(_timePerBlock);
                }

                if (iStartXPos >= 0)
                {
                    if (iPreviousEndXPos > iStartXPos)
                    {
                        iStartXPos = iPreviousEndXPos;
                    }
                    if (iEndXPos <= iStartXPos + 5)
                    {
                        iEndXPos = iStartXPos + 6; // at least 1 pixel width
                    }

                    int ypos = GetControl(iChannel + (int)Controls.IMG_CHAN1).YPosition;
                    int iControlId = GUIDE_COMPONENTID_START + iChannel * RowID + iProgram * ColID;
                    int iWidth = iEndXPos - iStartXPos;
                    if (iWidth > 3)
                    {
                        iWidth -= 3;
                    }
                    else
                    {
                        iWidth = 1;
                    }

                    string TexutureFocusLeftName = "tvguide_button_selected_left.png";
                    string TexutureFocusMidName = "tvguide_button_selected_middle.png";
                    string TexutureFocusRightName = "tvguide_button_selected_right.png";
                    string TexutureNoFocusLeftName = "tvguide_button_light_left.png";
                    string TexutureNoFocusMidName = "tvguide_button_light_middle.png";
                    string TexutureNoFocusRightName = "tvguide_button_light_right.png";

                    bool TileFillTFL = false;
                    bool TileFillTNFL = false;
                    bool TileFillTFM = false;
                    bool TileFillTNFM = false;
                    bool TileFillTFR = false;
                    bool TileFillTNFR = false;

                    if (_programNotRunningTemplate != null)
                    {
                        _programNotRunningTemplate.IsVisible = false;
                        TexutureFocusLeftName = _programNotRunningTemplate.TexutureFocusLeftName;
                        TexutureFocusMidName = _programNotRunningTemplate.TexutureFocusMidName;
                        TexutureFocusRightName = _programNotRunningTemplate.TexutureFocusRightName;
                        TexutureNoFocusLeftName = _programNotRunningTemplate.TexutureNoFocusLeftName;
                        TexutureNoFocusMidName = _programNotRunningTemplate.TexutureNoFocusMidName;
                        TexutureNoFocusRightName = _programNotRunningTemplate.TexutureNoFocusRightName;
                        TileFillTFL = _programNotRunningTemplate.TileFillTFL;
                        TileFillTNFL = _programNotRunningTemplate.TileFillTNFL;
                        TileFillTFM = _programNotRunningTemplate.TileFillTFM;
                        TileFillTNFM = _programNotRunningTemplate.TileFillTNFM;
                        TileFillTFR = _programNotRunningTemplate.TileFillTFR;
                        TileFillTNFR = _programNotRunningTemplate.TileFillTNFR;
                    }

                    img = GetControl(iControlId) as GUIButton3PartControl;
                    if (img == null)
                    {
                        img = new GUIButton3PartControl(GetID, iControlId, iStartXPos, ypos, iWidth, height - 2,
                                                        TexutureFocusLeftName,
                                                        TexutureFocusMidName,
                                                        TexutureFocusRightName,
                                                        TexutureNoFocusLeftName,
                                                        TexutureNoFocusMidName,
                                                        TexutureNoFocusRightName,
                                                        String.Empty);
                        img.AllocResources();
                        GUIControl cntl = (GUIControl)img;
                        Add(ref cntl);
                    }
                    else
                    {
                        img.Focus = false;
                        img.SetPosition(iStartXPos, ypos);
                        img.Width = iWidth;
                        img.IsVisible = true;
                        img.DoUpdate();
                    }

                    img.RenderLeft = false;
                    img.RenderRight = false;

                    img.TexutureIcon = String.Empty;
                    if (recordIconImage != null && isAlert)
                    {
                        if (_programNotifyTemplate != null)
                        {
                            _programNotifyTemplate.IsVisible = false;
                            TexutureFocusLeftName = _programNotifyTemplate.TexutureFocusLeftName;
                            TexutureFocusMidName = _programNotifyTemplate.TexutureFocusMidName;
                            TexutureFocusRightName = _programNotifyTemplate.TexutureFocusRightName;
                            TexutureNoFocusLeftName = _programNotifyTemplate.TexutureNoFocusLeftName;
                            TexutureNoFocusMidName = _programNotifyTemplate.TexutureNoFocusMidName;
                            TexutureNoFocusRightName = _programNotifyTemplate.TexutureNoFocusRightName;
                            TileFillTFL = _programNotifyTemplate.TileFillTFL;
                            TileFillTNFL = _programNotifyTemplate.TileFillTNFL;
                            TileFillTFM = _programNotifyTemplate.TileFillTFM;
                            TileFillTNFM = _programNotifyTemplate.TileFillTNFM;
                            TileFillTFR = _programNotifyTemplate.TileFillTFR;
                            TileFillTNFR = _programNotifyTemplate.TileFillTNFR;

                            // Use of the button template control implies use of the icon.  Use a blank image if the icon is not desired.
                            img.TexutureIcon = Thumbs.TvNotifyIcon;
                            img.IconOffsetX = _programNotifyTemplate.IconOffsetX;
                            img.IconOffsetY = _programNotifyTemplate.IconOffsetY;
                            img.IconAlign = _programNotifyTemplate.IconAlign;
                            img.IconVAlign = _programNotifyTemplate.IconVAlign;
                            img.IconInlineLabel1 = _programNotifyTemplate.IconInlineLabel1;
                        }
                        else
                        {
                            if (_useNewNotifyButtonColor)
                            {
                                TexutureFocusLeftName = "tvguide_notifyButton_Focus_left.png";
                                TexutureFocusMidName = "tvguide_notifyButton_Focus_middle.png";
                                TexutureFocusRightName = "tvguide_notifyButton_Focus_right.png";
                                TexutureNoFocusLeftName = "tvguide_notifyButton_noFocus_left.png";
                                TexutureNoFocusMidName = "tvguide_notifyButton_noFocus_middle.png";
                                TexutureNoFocusRightName = "tvguide_notifyButton_noFocus_right.png";
                            }
                            else
                            {
                                img.TexutureIcon = Thumbs.TvNotifyIcon;
                            }
                        }
                    }
                    if (recordIconImage != null)
                    {
                        // Select the partial recording template if needed.
                        //if (bPartialRecording)
                        //{
                        //    buttonRecordTemplate = _programPartialRecordTemplate;
                        //}

                        if (isRecording)
                        {
                            GUIButton3PartControl buttonRecordTemplate = _programRecordTemplate;
                            if (buttonRecordTemplate != null)
                            {
                                buttonRecordTemplate.IsVisible = false;
                                TexutureFocusLeftName = buttonRecordTemplate.TexutureFocusLeftName;
                                TexutureFocusMidName = buttonRecordTemplate.TexutureFocusMidName;
                                TexutureFocusRightName = buttonRecordTemplate.TexutureFocusRightName;
                                TexutureNoFocusLeftName = buttonRecordTemplate.TexutureNoFocusLeftName;
                                TexutureNoFocusMidName = buttonRecordTemplate.TexutureNoFocusMidName;
                                TexutureNoFocusRightName = buttonRecordTemplate.TexutureNoFocusRightName;
                                TileFillTFL = buttonRecordTemplate.TileFillTFL;
                                TileFillTNFL = buttonRecordTemplate.TileFillTNFL;
                                TileFillTFM = buttonRecordTemplate.TileFillTFM;
                                TileFillTNFM = buttonRecordTemplate.TileFillTNFM;
                                TileFillTFR = buttonRecordTemplate.TileFillTFR;
                                TileFillTNFR = buttonRecordTemplate.TileFillTNFR;

                                // Use of the button template control implies use of the icon.  Use a blank image if the icon is not desired.
                                //if (bConflict)
                                //{
                                //    TexutureFocusLeftName = "tvguide_recButton_Focus_left.png";
                                //    TexutureFocusMidName = "tvguide_recButton_Focus_middle.png";
                                //    TexutureFocusRightName = "tvguide_recButton_Focus_right.png";
                                //    TexutureNoFocusLeftName = "tvguide_recButton_noFocus_left.png";
                                //    TexutureNoFocusMidName = "tvguide_recButton_noFocus_middle.png";
                                //    TexutureNoFocusRightName = "tvguide_recButton_noFocus_right.png";
                                //}
                                img.IconOffsetX = buttonRecordTemplate.IconOffsetX;
                                img.IconOffsetY = buttonRecordTemplate.IconOffsetY;
                                img.IconAlign = buttonRecordTemplate.IconAlign;
                                img.IconVAlign = buttonRecordTemplate.IconVAlign;
                                img.IconInlineLabel1 = buttonRecordTemplate.IconInlineLabel1;
                            }
                            else
                            {
                                //if (bPartialRecording && _useNewPartialRecordingButtonColor)
                                //{
                                //    TexutureFocusLeftName = "tvguide_partRecButton_Focus_left.png";
                                //    TexutureFocusMidName = "tvguide_partRecButton_Focus_middle.png";
                                //    TexutureFocusRightName = "tvguide_partRecButton_Focus_right.png";
                                //    TexutureNoFocusLeftName = "tvguide_partRecButton_noFocus_left.png";
                                //    TexutureNoFocusMidName = "tvguide_partRecButton_noFocus_middle.png";
                                //    TexutureNoFocusRightName = "tvguide_partRecButton_noFocus_right.png";
                                //}
                                //else
                                {
                                    if (_useNewRecordingButtonColor)
                                    {
                                        TexutureFocusLeftName = "tvguide_recButton_Focus_left.png";
                                        TexutureFocusMidName = "tvguide_recButton_Focus_middle.png";
                                        TexutureFocusRightName = "tvguide_recButton_Focus_right.png";
                                        TexutureNoFocusLeftName = "tvguide_recButton_noFocus_left.png";
                                        TexutureNoFocusMidName = "tvguide_recButton_noFocus_middle.png";
                                        TexutureNoFocusRightName = "tvguide_recButton_noFocus_right.png";
                                    }
                                }
                            }
                        }
                        img.TexutureIcon = recordIconImage;
                    }

                    img.TexutureIcon2 = String.Empty;
                    if (bProgramIsHD)
                    {
                        if (_programNotRunningTemplate != null)
                        {
                            img.TexutureIcon2 = _programNotRunningTemplate.TexutureIcon2;
                        }
                        else
                        {
                            if (_useHdProgramIcon)
                            {
                                img.TexutureIcon2 = "tvguide_hd_program.png";
                            }
                        }
                        img.Icon2InlineLabel1 = true;
                        img.Icon2VAlign = GUIControl.VAlignment.ALIGN_MIDDLE;
                        img.Icon2OffsetX = 5;
                    }
                    img.Data = program;
                    img.ColourDiffuse = GetColorForGenre(program.Category);

                    iWidth = iEndXPos - iStartXPos;
                    if (iWidth > 10)
                    {
                        iWidth -= 10;
                    }
                    else
                    {
                        iWidth = 1;
                    }

                    DateTime dt = DateTime.Now;

                    img.TextOffsetX1 = 5;
                    img.TextOffsetY1 = 5;
                    img.FontName1 = "font13";
                    img.TextColor1 = 0xffffffff;
                    img.Label1 = strTitle;
                    GUILabelControl labelTemplate;
                    if (IsRunningAt(program, dt))
                    {
                        labelTemplate = _titleDarkTemplate;
                    }
                    else
                    {
                        labelTemplate = _titleTemplate;
                    }

                    if (labelTemplate != null)
                    {
                        img.FontName1 = labelTemplate.FontName;
                        img.TextColor1 = labelTemplate.TextColor;
                        img.TextColor2 = labelTemplate.TextColor;
                        img.TextOffsetX1 = labelTemplate.XPosition;
                        img.TextOffsetY1 = labelTemplate.YPosition;
                        img.SetShadow1(labelTemplate.ShadowAngle, labelTemplate.ShadowDistance, labelTemplate.ShadowColor);

                        // This is a legacy behavior check.  Adding labelTemplate.XPosition and labelTemplate.YPosition requires
                        // skinners to add these values to the skin xml unless this check exists.  Perform a sanity check on the
                        // x,y position to ensure it falls into the bounds of the button.  If it does not then fall back to use the
                        // legacy values.  This check is necessary because the x,y position (without skin file changes) will be taken
                        // from either the references.xml control template or the controls coded defaults.
                        if (img.TextOffsetY1 > img.Height)
                        {
                            // Set legacy values.
                            img.TextOffsetX1 = 5;
                            img.TextOffsetY1 = 5;
                        }
                    }
                    img.TextOffsetX2 = 5;
                    img.TextOffsetY2 = img.Height / 2;
                    img.FontName2 = "font13";
                    img.TextColor2 = 0xffffffff;

                    if (IsRunningAt(program, dt))
                    {
                        labelTemplate = _genreDarkTemplate;
                    }
                    else
                    {
                        labelTemplate = _genreTemplate;
                    }
                    if (labelTemplate != null)
                    {
                        img.FontName2 = labelTemplate.FontName;
                        img.TextColor2 = labelTemplate.TextColor;
                        img.Label2 = program.Category;
                        img.TextOffsetX2 = labelTemplate.XPosition;
                        img.TextOffsetY2 = labelTemplate.YPosition;
                        img.SetShadow2(labelTemplate.ShadowAngle, labelTemplate.ShadowDistance, labelTemplate.ShadowColor);

                        // This is a legacy behavior check.  Adding labelTemplate.XPosition and labelTemplate.YPosition requires
                        // skinners to add these values to the skin xml unless this check exists.  Perform a sanity check on the
                        // x,y position to ensure it falls into the bounds of the button.  If it does not then fall back to use the
                        // legacy values.  This check is necessary because the x,y position (without skin file changes) will be taken
                        // from either the references.xml control template or the controls coded defaults.
                        if (img.TextOffsetY2 > img.Height)
                        {
                            // Set legacy values.
                            img.TextOffsetX2 = 5;
                            img.TextOffsetY2 = 5;
                        }
                    }

                    if (IsRunningAt(program, dt))
                    {
                        GUIButton3PartControl buttonRunningTemplate = _programRunningTemplate;
                        if (!isRecording && !isAlert && buttonRunningTemplate != null)
                        {
                            buttonRunningTemplate.IsVisible = false;
                            TexutureFocusLeftName = buttonRunningTemplate.TexutureFocusLeftName;
                            TexutureFocusMidName = buttonRunningTemplate.TexutureFocusMidName;
                            TexutureFocusRightName = buttonRunningTemplate.TexutureFocusRightName;
                            TexutureNoFocusLeftName = buttonRunningTemplate.TexutureNoFocusLeftName;
                            TexutureNoFocusMidName = buttonRunningTemplate.TexutureNoFocusMidName;
                            TexutureNoFocusRightName = buttonRunningTemplate.TexutureNoFocusRightName;
                            TileFillTFL = buttonRunningTemplate.TileFillTFL;
                            TileFillTNFL = buttonRunningTemplate.TileFillTNFL;
                            TileFillTFM = buttonRunningTemplate.TileFillTFM;
                            TileFillTNFM = buttonRunningTemplate.TileFillTNFM;
                            TileFillTFR = buttonRunningTemplate.TileFillTFR;
                            TileFillTNFR = buttonRunningTemplate.TileFillTNFR;
                        }
                        else if (isRecording && _useNewRecordingButtonColor)
                        {
                            TexutureFocusLeftName = "tvguide_recButton_Focus_left.png";
                            TexutureFocusMidName = "tvguide_recButton_Focus_middle.png";
                            TexutureFocusRightName = "tvguide_recButton_Focus_right.png";
                            TexutureNoFocusLeftName = "tvguide_recButton_noFocus_left.png";
                            TexutureNoFocusMidName = "tvguide_recButton_noFocus_middle.png";
                            TexutureNoFocusRightName = "tvguide_recButton_noFocus_right.png";
                        }
                        else if (isAlert && _useNewRecordingButtonColor)
                        {
                            TexutureFocusLeftName = "tvguide_notifyButton_Focus_left.png";
                            TexutureFocusMidName = "tvguide_notifyButton_Focus_middle.png";
                            TexutureFocusRightName = "tvguide_notifyButton_Focus_right.png";
                            TexutureNoFocusLeftName = "tvguide_notifyButton_noFocus_left.png";
                            TexutureNoFocusMidName = "tvguide_notifyButton_noFocus_middle.png";
                            TexutureNoFocusRightName = "tvguide_notifyButton_noFocus_right.png";
                        }
                        else
                        {
                            TexutureFocusLeftName = "tvguide_button_selected_left.png";
                            TexutureFocusMidName = "tvguide_button_selected_middle.png";
                            TexutureFocusRightName = "tvguide_button_selected_right.png";
                            TexutureNoFocusLeftName = "tvguide_button_left.png";
                            TexutureNoFocusMidName = "tvguide_button_middle.png";
                            TexutureNoFocusRightName = "tvguide_button_right.png";
                        }

                        if (selectCurrentShow && iChannel == _cursorX)
                        {
                            _cursorY = iProgram + 1;
                            _currentProgram = Proxies.GuideService.GetProgramById(program.GuideProgramId).Result;
                            m_dtStartTime = program.StartTime;
                            SetProperties();
                        }
                    }

                    if (bEndsAfter)
                    {
                        img.RenderRight = true;

                        TexutureFocusRightName = "tvguide_arrow_selected_right.png";
                        TexutureNoFocusRightName = "tvguide_arrow_light_right.png";
                        if (IsRunningAt(program, dt))
                        {
                            TexutureNoFocusRightName = "tvguide_arrow_right.png";
                        }
                    }
                    if (bStartsBefore)
                    {
                        img.RenderLeft = true;
                        TexutureFocusLeftName = "tvguide_arrow_selected_left.png";
                        TexutureNoFocusLeftName = "tvguide_arrow_light_left.png";
                        if (IsRunningAt(program, dt))
                        {
                            TexutureNoFocusLeftName = "tvguide_arrow_left.png";
                        }
                    }

                    img.TexutureFocusLeftName = TexutureFocusLeftName;
                    img.TexutureFocusMidName = TexutureFocusMidName;
                    img.TexutureFocusRightName = TexutureFocusRightName;
                    img.TexutureNoFocusLeftName = TexutureNoFocusLeftName;
                    img.TexutureNoFocusMidName = TexutureNoFocusMidName;
                    img.TexutureNoFocusRightName = TexutureNoFocusRightName;

                    img.TileFillTFL = TileFillTFL;
                    img.TileFillTNFL = TileFillTNFL;
                    img.TileFillTFM = TileFillTFM;
                    img.TileFillTNFM = TileFillTNFM;
                    img.TileFillTFR = TileFillTFR;
                    img.TileFillTNFR = TileFillTNFR;

                    iProgram++;
                }
                iPreviousEndXPos = iEndXPos;
            }
        }
コード例 #8
0
ファイル: GuideBase.cs プロジェクト: Christoph21x/ARGUS-TV
        private void RenderSingleChannel(Channel channel)
        {
            string strLogo;
            int chan = _channelOffset;
            for (int iChannel = 0; iChannel < _channelCount; iChannel++)
            {
                if (chan < _channelList.Count)
                {
                    Channel tvChan = _channelList[chan].channel;

                    strLogo = GetChannelLogo(tvChan);
                    GUIButton3PartControl img = GetControl(iChannel + (int)Controls.IMG_CHAN1) as GUIButton3PartControl;
                    if (img != null)
                    {
                        if (_showChannelLogos)
                        {
                            img.TexutureIcon = strLogo;
                        }
                        img.Label1 = tvChan.DisplayName;
                        img.Data = tvChan;
                        img.IsVisible = true;
                    }
                }
                chan++;
            }

            List<GuideProgramSummary> programs = new List<GuideProgramSummary>();
            DateTime dtStart = DateTime.Now;
            dtStart = dtStart.AddDays(-1);
            DateTime dtEnd = dtStart.AddDays(30);
            long iStart = Utils.datetolong(dtStart);
            long iEnd = Utils.datetolong(dtEnd);

            if (channel.GuideChannelId.HasValue)
            {
                programs = new List<GuideProgramSummary>(
                    Proxies.GuideService.GetChannelProgramsBetween(channel.GuideChannelId.Value, Utils.longtodate(iStart), Utils.longtodate(iEnd)).Result);
            }

            _totalProgramCount = programs.Count;
            if (_totalProgramCount == 0)
            {
                _totalProgramCount = _channelCount;
            }

            GUILabelControl channelLabel = GetControl((int)Controls.SINGLE_CHANNEL_LABEL) as GUILabelControl;
            GUIImage channelImage = GetControl((int)Controls.SINGLE_CHANNEL_IMAGE) as GUIImage;

            strLogo = GetChannelLogo(channel);
            if (channelImage == null)
            {
                if (strLogo.Length > 0)
                {
                    channelImage = new GUIImage(GetID, (int)Controls.SINGLE_CHANNEL_IMAGE,
                                                GetControl((int)Controls.LABEL_TIME1).XPosition,
                                                GetControl((int)Controls.LABEL_TIME1).YPosition - 15,
                                                40, 40, strLogo, Color.White);
                    channelImage.AllocResources();
                    GUIControl temp = (GUIControl)channelImage;
                    Add(ref temp);
                }
            }
            else
            {
                channelImage.SetFileName(strLogo);
            }

            if (channelLabel == null)
            {
                channelLabel = new GUILabelControl(GetID, (int)Controls.SINGLE_CHANNEL_LABEL,
                                                   channelImage.XPosition + 44,
                                                   channelImage.YPosition + 10,
                                                   300, 40, "font16", channel.DisplayName, 4294967295, GUIControl.Alignment.Left,
                                                   GUIControl.VAlignment.Top,
                                                   true, 0, 0, 0xFF000000);
                channelLabel.AllocResources();
                GUIControl temp = channelLabel;
                Add(ref temp);
            }

            SetSingleChannelLabelVisibility(true);

            channelLabel.Label = channel.DisplayName;
            if (strLogo.Length > 0)
            {
                channelImage.SetFileName(strLogo);
            }

            if (channelLabel != null)
            {
                channelLabel.Label = channel.DisplayName;
            }
            if (_recalculateProgramOffset)
            {
                _recalculateProgramOffset = false;
                bool found = false;
                for (int i = 0; i < programs.Count; i++)
                {
                    GuideProgramSummary program = programs[i];
                    if (program.StartTime <= _viewingTime && program.StopTime >= _viewingTime)
                    {
                        _programOffset = i;
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    _programOffset = 0;
                }
            }
            else if (_programOffset < programs.Count)
            {
                int day = programs[_programOffset].StartTime.DayOfYear;
                bool changed = false;
                while (day > _viewingTime.DayOfYear)
                {
                    _viewingTime = _viewingTime.AddDays(1.0);
                    changed = true;
                }
                while (day < _viewingTime.DayOfYear)
                {
                    _viewingTime = _viewingTime.AddDays(-1.0);
                    changed = true;
                }
                if (changed)
                {
                    GUISpinControl cntlDay = GetControl((int)Controls.SPINCONTROL_DAY) as GUISpinControl;

                    // Find first day in TVGuide and set spincontrol position
                    int iDay = CalcDays();
                    for (; iDay < 0; ++iDay)
                    {
                        _viewingTime = _viewingTime.AddDays(1.0);
                    }
                    for (; iDay >= MaxDaysInGuide; --iDay)
                    {
                        _viewingTime = _viewingTime.AddDays(-1.0);
                    }
                    cntlDay.Value = iDay;
                }
            }
            // ichan = number of rows
            for (int ichan = 0; ichan < _channelCount; ++ichan)
            {
                GUIButton3PartControl imgCh = GetControl(ichan + (int)Controls.IMG_CHAN1) as GUIButton3PartControl;
                imgCh.TexutureIcon = "";

                int iStartXPos = GetControl(0 + (int)Controls.LABEL_TIME1).XPosition;
                int height = GetControl((int)Controls.IMG_CHAN1 + 1).YPosition;
                height -= GetControl((int)Controls.IMG_CHAN1).YPosition;
                int width = GetControl((int)Controls.LABEL_TIME1 + 1).XPosition;
                width -= GetControl((int)Controls.LABEL_TIME1).XPosition;

                int iTotalWidth = width * _numberOfBlocks;

                GuideProgramSummary program;
                int offset = _programOffset;
                if (offset + ichan < programs.Count)
                {
                    program = programs[offset + ichan];
                }
                else
                {
                    // bugfix for 0 items
                    if (programs.Count == 0)
                    {
                        program = new GuideProgramSummary()
                        {
                            StartTime = _viewingTime,
                            StopTime = _viewingTime,
                            StartTimeUtc = _viewingTime.ToUniversalTime(),
                            StopTimeUtc = _viewingTime.ToUniversalTime(),
                            Title = String.Empty,
                            Category = String.Empty
                        };
                    }
                    else
                    {
                        program = programs[programs.Count - 1];
                        if (program.StopTime.DayOfYear == _viewingTime.DayOfYear)
                        {
                            program = new GuideProgramSummary()
                            {
                                StartTime = program.StopTime,
                                StopTime = program.StopTime,
                                StartTimeUtc = program.StartTimeUtc,
                                StopTimeUtc = program.StopTimeUtc,
                                Title = String.Empty,
                                Category = String.Empty
                            };
                        }
                        else
                        {
                            program = new GuideProgramSummary()
                            {
                                StartTime = _viewingTime,
                                StopTime = _viewingTime,
                                StartTimeUtc = _viewingTime.ToUniversalTime(),
                                StopTimeUtc = _viewingTime.ToUniversalTime(),
                                Title = String.Empty,
                                Category = String.Empty
                            };
                        }
                    }
                }

                int ypos = GetControl(ichan + (int)Controls.IMG_CHAN1).YPosition;
                int iControlId = GUIDE_COMPONENTID_START + ichan * RowID + 0 * ColID;
                GUIButton3PartControl img = GetControl(iControlId) as GUIButton3PartControl;
                GUIButton3PartControl buttonTemplate = GetControl((int)Controls.BUTTON_PROGRAM_NOT_RUNNING) as GUIButton3PartControl;

                if (img == null)
                {
                    if (buttonTemplate != null)
                    {
                        buttonTemplate.IsVisible = false;
                        img = new GUIButton3PartControl(GetID, iControlId, iStartXPos, ypos, iTotalWidth, height - 2,
                                                        buttonTemplate.TexutureFocusLeftName,
                                                        buttonTemplate.TexutureFocusMidName,
                                                        buttonTemplate.TexutureFocusRightName,
                                                        buttonTemplate.TexutureNoFocusLeftName,
                                                        buttonTemplate.TexutureNoFocusMidName,
                                                        buttonTemplate.TexutureNoFocusRightName,
                                                        String.Empty);

                        img.TileFillTFL = buttonTemplate.TileFillTFL;
                        img.TileFillTNFL = buttonTemplate.TileFillTNFL;
                        img.TileFillTFM = buttonTemplate.TileFillTFM;
                        img.TileFillTNFM = buttonTemplate.TileFillTNFM;
                        img.TileFillTFR = buttonTemplate.TileFillTFR;
                        img.TileFillTNFR = buttonTemplate.TileFillTNFR;
                    }
                    else
                    {
                        img = new GUIButton3PartControl(GetID, iControlId, iStartXPos, ypos, iTotalWidth, height - 2,
                                                        "tvguide_button_selected_left.png",
                                                        "tvguide_button_selected_middle.png",
                                                        "tvguide_button_selected_right.png",
                                                        "tvguide_button_light_left.png",
                                                        "tvguide_button_light_middle.png",
                                                        "tvguide_button_light_right.png",
                                                        String.Empty);
                    }
                    img.AllocResources();
                    img.ColourDiffuse = GetColorForGenre(program.Category);
                    GUIControl cntl = (GUIControl)img;
                    Add(ref cntl);
                }
                else
                {
                    if (buttonTemplate != null)
                    {
                        buttonTemplate.IsVisible = false;
                        img.TexutureFocusLeftName = buttonTemplate.TexutureFocusLeftName;
                        img.TexutureFocusMidName = buttonTemplate.TexutureFocusMidName;
                        img.TexutureFocusRightName = buttonTemplate.TexutureFocusRightName;
                        img.TexutureNoFocusLeftName = buttonTemplate.TexutureNoFocusLeftName;
                        img.TexutureNoFocusMidName = buttonTemplate.TexutureNoFocusMidName;
                        img.TexutureNoFocusRightName = buttonTemplate.TexutureNoFocusRightName;
                        img.TileFillTFL = buttonTemplate.TileFillTFL;
                        img.TileFillTNFL = buttonTemplate.TileFillTNFL;
                        img.TileFillTFM = buttonTemplate.TileFillTFM;
                        img.TileFillTNFM = buttonTemplate.TileFillTNFM;
                        img.TileFillTFR = buttonTemplate.TileFillTFR;
                        img.TileFillTNFR = buttonTemplate.TileFillTNFR;
                    }
                    else
                    {
                        img.TexutureFocusLeftName = "tvguide_button_selected_left.png";
                        img.TexutureFocusMidName = "tvguide_button_selected_middle.png";
                        img.TexutureFocusRightName = "tvguide_button_selected_right.png";
                        img.TexutureNoFocusLeftName = "tvguide_button_light_left.png";
                        img.TexutureNoFocusMidName = "tvguide_button_light_middle.png";
                        img.TexutureNoFocusRightName = "tvguide_button_light_right.png";
                    }
                    img.Focus = false;
                    img.SetPosition(iStartXPos, ypos);
                    img.Width = iTotalWidth;
                    img.ColourDiffuse = GetColorForGenre(program.Category);
                    img.IsVisible = true;
                    img.DoUpdate();
                }
                img.RenderLeft = false;
                img.RenderRight = false;

                bool isRecording;
                bool isAlert;
                string recordIconImage = GetChannelProgramIcon(channel, program.GuideProgramId, out isRecording,out isAlert);

                img.Data = program;
                img.ColourDiffuse = GetColorForGenre(program.Category);
                height = height - 10;
                height /= 2;
                int iWidth = iTotalWidth;
                if (iWidth > 10)
                {
                    iWidth -= 10;
                }
                else
                {
                    iWidth = 1;
                }

                DateTime dt = DateTime.Now;

                img.TextOffsetX1 = 5;
                img.TextOffsetY1 = 5;
                img.FontName1 = "font13";
                img.TextColor1 = 0xffffffff;

                img.Label1 = program.CreateProgramTitle();

                string strTimeSingle = String.Format("{0}",
                                                     program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                if (program.StartTime.DayOfYear != _viewingTime.DayOfYear)
                {
                    img.Label1 = String.Format("{0} {1}", Utility.GetShortDayDateString(program.StartTime), program.CreateProgramTitle());
                }

                GUILabelControl labelTemplate;
                if (IsRunningAt(program, dt))
                {
                    labelTemplate = _titleDarkTemplate;
                }
                else
                {
                    labelTemplate = _titleTemplate;
                }

                if (labelTemplate != null)
                {
                    img.FontName1 = labelTemplate.FontName;
                    img.TextColor1 = labelTemplate.TextColor;
                    img.TextOffsetX1 = labelTemplate.XPosition;
                    img.TextOffsetY1 = labelTemplate.YPosition;
                    img.SetShadow1(labelTemplate.ShadowAngle, labelTemplate.ShadowDistance, labelTemplate.ShadowColor);
                }
                img.TextOffsetX2 = 5;
                img.TextOffsetY2 = img.Height / 2;
                img.FontName2 = "font13";
                img.TextColor2 = 0xffffffff;
                img.Label2 = "";
                if (IsRunningAt(program, dt))
                {
                    img.TextColor2 = 0xff101010;
                    labelTemplate = _genreDarkTemplate;
                }
                else
                {
                    labelTemplate = _genreTemplate;
                }

                if (labelTemplate != null)
                {
                    img.FontName2 = labelTemplate.FontName;
                    img.TextColor2 = labelTemplate.TextColor;
                    img.Label2 = program.Category;
                    img.TextOffsetX2 = labelTemplate.XPosition;
                    img.TextOffsetY2 = labelTemplate.YPosition;
                    img.SetShadow2(labelTemplate.ShadowAngle, labelTemplate.ShadowDistance, labelTemplate.ShadowColor);
                }
                imgCh.Label1 = strTimeSingle;
                imgCh.TexutureIcon = "";

                if (IsRunningAt(program, dt))
                {
                    GUIButton3PartControl buttonRunningTemplate = _programRunningTemplate;
                    if (buttonRunningTemplate != null)
                    {
                        buttonRunningTemplate.IsVisible = false;
                        img.TexutureFocusLeftName = buttonRunningTemplate.TexutureFocusLeftName;
                        img.TexutureFocusMidName = buttonRunningTemplate.TexutureFocusMidName;
                        img.TexutureFocusRightName = buttonRunningTemplate.TexutureFocusRightName;
                        img.TexutureNoFocusLeftName = buttonRunningTemplate.TexutureNoFocusLeftName;
                        img.TexutureNoFocusMidName = buttonRunningTemplate.TexutureNoFocusMidName;
                        img.TexutureNoFocusRightName = buttonRunningTemplate.TexutureNoFocusRightName;
                        img.TileFillTFL = buttonRunningTemplate.TileFillTFL;
                        img.TileFillTNFL = buttonRunningTemplate.TileFillTNFL;
                        img.TileFillTFM = buttonRunningTemplate.TileFillTFM;
                        img.TileFillTNFM = buttonRunningTemplate.TileFillTNFM;
                        img.TileFillTFR = buttonRunningTemplate.TileFillTFR;
                        img.TileFillTNFR = buttonRunningTemplate.TileFillTNFR;
                    }
                    else
                    {
                        img.TexutureFocusLeftName = "tvguide_button_selected_left.png";
                        img.TexutureFocusMidName = "tvguide_button_selected_middle.png";
                        img.TexutureFocusRightName = "tvguide_button_selected_right.png";
                        img.TexutureNoFocusLeftName = "tvguide_button_left.png";
                        img.TexutureNoFocusMidName = "tvguide_button_middle.png";
                        img.TexutureNoFocusRightName = "tvguide_button_right.png";
                    }
                }

                img.SetPosition(img.XPosition, img.YPosition);

                img.TexutureIcon = String.Empty;

                if (recordIconImage != null && isAlert)
                {
                    GUIButton3PartControl buttonNotifyTemplate = GetControl((int)Controls.BUTTON_PROGRAM_NOTIFY) as GUIButton3PartControl;
                    if (buttonNotifyTemplate != null)
                    {
                        buttonNotifyTemplate.IsVisible = false;
                        img.TexutureFocusLeftName = buttonNotifyTemplate.TexutureFocusLeftName;
                        img.TexutureFocusMidName = buttonNotifyTemplate.TexutureFocusMidName;
                        img.TexutureFocusRightName = buttonNotifyTemplate.TexutureFocusRightName;
                        img.TexutureNoFocusLeftName = buttonNotifyTemplate.TexutureNoFocusLeftName;
                        img.TexutureNoFocusMidName = buttonNotifyTemplate.TexutureNoFocusMidName;
                        img.TexutureNoFocusRightName = buttonNotifyTemplate.TexutureNoFocusRightName;
                        img.TileFillTFL = buttonNotifyTemplate.TileFillTFL;
                        img.TileFillTNFL = buttonNotifyTemplate.TileFillTNFL;
                        img.TileFillTFM = buttonNotifyTemplate.TileFillTFM;
                        img.TileFillTNFM = buttonNotifyTemplate.TileFillTNFM;
                        img.TileFillTFR = buttonNotifyTemplate.TileFillTFR;
                        img.TileFillTNFR = buttonNotifyTemplate.TileFillTNFR;

                        // Use of the button template control implies use of the icon.  Use a blank image if the icon is not desired.
                        img.TexutureIcon = Thumbs.TvNotifyIcon;
                        img.IconOffsetX = buttonNotifyTemplate.IconOffsetX;
                        img.IconOffsetY = buttonNotifyTemplate.IconOffsetY;
                        img.IconAlign = buttonNotifyTemplate.IconAlign;
                        img.IconVAlign = buttonNotifyTemplate.IconVAlign;
                        img.IconInlineLabel1 = buttonNotifyTemplate.IconInlineLabel1;
                    }
                    else
                    {
                        if (_useNewNotifyButtonColor)
                        {
                            img.TexutureFocusLeftName = "tvguide_notifyButton_Focus_left.png";
                            img.TexutureFocusMidName = "tvguide_notifyButton_Focus_middle.png";
                            img.TexutureFocusRightName = "tvguide_notifyButton_Focus_right.png";
                            img.TexutureNoFocusLeftName = "tvguide_notifyButton_noFocus_left.png";
                            img.TexutureNoFocusMidName = "tvguide_notifyButton_noFocus_middle.png";
                            img.TexutureNoFocusRightName = "tvguide_notifyButton_noFocus_right.png";
                        }
                        else
                        {
                            img.TexutureIcon = Thumbs.TvNotifyIcon;
                        }
                    }
                }

                if (recordIconImage != null)
                {
                    //bool bPartialRecording = program.IsPartialRecordingSeriesPending;
                    GUIButton3PartControl buttonRecordTemplate = GetControl((int)Controls.BUTTON_PROGRAM_RECORD) as GUIButton3PartControl;

                    // Select the partial recording template if needed.
                    //if (bPartialRecording)
                    //{
                    //    buttonRecordTemplate = GetControl((int)Controls.BUTTON_PROGRAM_PARTIAL_RECORD) as GUIButton3PartControl;
                    //}

                    if (isRecording)
                    {
                        if (buttonRecordTemplate != null)
                        {
                            buttonRecordTemplate.IsVisible = false;
                            img.TexutureFocusLeftName = buttonRecordTemplate.TexutureFocusLeftName;
                            img.TexutureFocusMidName = buttonRecordTemplate.TexutureFocusMidName;
                            img.TexutureFocusRightName = buttonRecordTemplate.TexutureFocusRightName;
                            img.TexutureNoFocusLeftName = buttonRecordTemplate.TexutureNoFocusLeftName;
                            img.TexutureNoFocusMidName = buttonRecordTemplate.TexutureNoFocusMidName;
                            img.TexutureNoFocusRightName = buttonRecordTemplate.TexutureNoFocusRightName;
                            img.TileFillTFL = buttonRecordTemplate.TileFillTFL;
                            img.TileFillTNFL = buttonRecordTemplate.TileFillTNFL;
                            img.TileFillTFM = buttonRecordTemplate.TileFillTFM;
                            img.TileFillTNFM = buttonRecordTemplate.TileFillTNFM;
                            img.TileFillTFR = buttonRecordTemplate.TileFillTFR;
                            img.TileFillTNFR = buttonRecordTemplate.TileFillTNFR;

                            // Use of the button template control implies use of the icon.  Use a blank image if the icon is not desired.
                            //if (bConflict)
                            //{
                            //    img.TexutureFocusLeftName = "tvguide_recButton_Focus_left.png";
                            //    img.TexutureFocusMidName = "tvguide_recButton_Focus_middle.png";
                            //    img.TexutureFocusRightName = "tvguide_recButton_Focus_right.png";
                            //    img.TexutureNoFocusLeftName = "tvguide_recButton_noFocus_left.png";
                            //    img.TexutureNoFocusMidName = "tvguide_recButton_noFocus_middle.png";
                            //    img.TexutureNoFocusRightName = "tvguide_recButton_noFocus_right.png";
                            //}
                            img.IconOffsetX = buttonRecordTemplate.IconOffsetX;
                            img.IconOffsetY = buttonRecordTemplate.IconOffsetY;
                            img.IconAlign = buttonRecordTemplate.IconAlign;
                            img.IconVAlign = buttonRecordTemplate.IconVAlign;
                            img.IconInlineLabel1 = buttonRecordTemplate.IconInlineLabel1;
                        }
                        else
                        {
                            //if (bPartialRecording && _useNewPartialRecordingButtonColor)
                            //{
                            //    img.TexutureFocusLeftName = "tvguide_partRecButton_Focus_left.png";
                            //    img.TexutureFocusMidName = "tvguide_partRecButton_Focus_middle.png";
                            //    img.TexutureFocusRightName = "tvguide_partRecButton_Focus_right.png";
                            //    img.TexutureNoFocusLeftName = "tvguide_partRecButton_noFocus_left.png";
                            //    img.TexutureNoFocusMidName = "tvguide_partRecButton_noFocus_middle.png";
                            //    img.TexutureNoFocusRightName = "tvguide_partRecButton_noFocus_right.png";
                            //}
                            //else
                            {
                                if (_useNewRecordingButtonColor)
                                {
                                    img.TexutureFocusLeftName = "tvguide_recButton_Focus_left.png";
                                    img.TexutureFocusMidName = "tvguide_recButton_Focus_middle.png";
                                    img.TexutureFocusRightName = "tvguide_recButton_Focus_right.png";
                                    img.TexutureNoFocusLeftName = "tvguide_recButton_noFocus_left.png";
                                    img.TexutureNoFocusMidName = "tvguide_recButton_noFocus_middle.png";
                                    img.TexutureNoFocusRightName = "tvguide_recButton_noFocus_right.png";
                                }
                            }
                        }
                    }

                    img.TexutureIcon = recordIconImage;
                }
            }
        }
コード例 #9
0
 private string GetProgramDescription(GuideProgramSummary program)
 {
     return program.StartTime.ToShortTimeString() + " - " + program.StopTime.ToShortTimeString() + " " + program.CreateProgramTitle();
 }
コード例 #10
0
ファイル: Programs.cs プロジェクト: ElRakiti/ARGUS-TV
 public Programs(Channel channel, GuideProgramSummary[] guidePrograms)
 {
     _channel = channel;
     _guidePrograms = guidePrograms;
 }