/// <summary> /// Loads the logo page from the assembly /// </summary> protected void LoadLogoPage() { Assembly assm = Assembly.GetExecutingAssembly(); Stream stream = assm.GetManifestResourceStream("ArgusTV.UI.MediaPortal.TeletextLogoPage"); if (stream != null) { using (BinaryReader reader = new BinaryReader(stream)) { _receivedTeletextPage = new TeletextPage(); byte[] teletextPageBytes = new byte[stream.Length]; reader.Read(teletextPageBytes, 0, (int)stream.Length); _receivedTeletextPage.Content = teletextPageBytes; _receivedTeletextPage.PageNumber = 0; _receivedTeletextPage.SubPageNumber = 0; } } }
/// <summary> /// Retrieve the new page from the server /// </summary> protected void GetNewPage() { int sub = currentSubPageNumber; int maxSubs = _receivedTeletextPage == null ? 1 : _receivedTeletextPage.SubPageCount; // Check if the page is available if (maxSubs <= 0) { if (_receivedTeletextPage != null && _receivedTeletextPage.Content != null && !_waiting) { bmpTeletextPage = _renderer.RenderPage(_receivedTeletextPage.Content, receivedPageNumber, receivedSubPageNumber); Log.Info("dvb-teletext: received page {0:X} / subpage {1:X}", receivedPageNumber, receivedSubPageNumber); } Redraw(); return; } if (sub >= maxSubs) { sub = maxSubs - 1; } // Get the page TeletextPage teletextPage = PluginMain.Navigator.GetTeletextPage(currentPageNumber, sub); // Was the page available, then render it. Otherwise render the last page again and update the header line, if // it was for the first time if (teletextPage != null) { _receivedTeletextPage = teletextPage; receivedPageNumber = currentPageNumber; receivedSubPageNumber = currentSubPageNumber; bmpTeletextPage = _renderer.RenderPage(_receivedTeletextPage.Content, _receivedTeletextPage.PageNumber, sub); _waiting = false; Log.Info("dvb-teletext: select page {0:X} / subpage {1:X}", currentPageNumber, currentSubPageNumber); } else { if (_receivedTeletextPage != null && _receivedTeletextPage.Content != null && !_waiting) { bmpTeletextPage = _renderer.RenderPage(_receivedTeletextPage.Content, receivedPageNumber, receivedSubPageNumber); Log.Info("dvb-teletext: received page {0:X} / subpage {1:X}", receivedPageNumber, receivedSubPageNumber); } _waiting = true; } Redraw(); }