/// <summary> /// scans current transponder for more channels. /// </summary> /// <param name="channel">IChannel containing the transponder tuning details.</param> /// <param name="settings">Scan settings</param> /// <returns>list of channels found</returns> public IChannel[] Scan(IChannel channel, ScanParameters settings) { try { if (_cardHandler.DataBaseCard.Enabled == false) { return(new List <IChannel>().ToArray()); } try { RemoteControl.HostName = _cardHandler.DataBaseCard.ReferencedServer().HostName; if (!RemoteControl.Instance.CardPresent(_cardHandler.DataBaseCard.IdCard)) { return(new List <IChannel>().ToArray()); } if (_cardHandler.IsLocal == false) { return(RemoteControl.Instance.Scan(_cardHandler.DataBaseCard.IdCard, channel)); } } catch (Exception) { Log.Error("card: unable to connect to slave controller at:{0}", _cardHandler.DataBaseCard.ReferencedServer().HostName); return(null); } ITVScanning scanner = _cardHandler.Card.ScanningInterface; if (scanner == null) { return(null); } scanner.Reset(); List <IChannel> channelsFound = scanner.Scan(channel, settings); if (channelsFound == null) { return(null); } return(channelsFound.ToArray()); } catch (TvExceptionNoSignal) { //ignore return(null); } catch (Exception ex) { Log.Write(ex); return(null); } }
private void buttonScan_Click(object sender, EventArgs e) { if ((_currentCard as TvCardAnalog) != null) { if ( MessageBox.Show(this, "Scanning is not possible for analog tv cards. (try it anyway ?:) )", "Not posible, Try anyway ?", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } } timer1.Enabled = false; buttonTimeShiftTS.Enabled = false; buttonRecordMpg.Enabled = false; buttonTimeShift.Enabled = false; buttonRecord.Enabled = false; buttonTune.Enabled = false; buttonScan.Enabled = false; btnEPG.Enabled = false; ITVScanning scanner = _currentCard.ScanningInterface; scanner.Reset(); List <IChannel> channels = scanner.Scan(_currentCard.SubChannels[0].CurrentChannel, new TvLibrary.ScanParameters()); scanner.Dispose(); listViewChannels.Items.Clear(); foreach (IChannel channel in channels) { ListViewItem item = new ListViewItem(channel.ToString()); item.Tag = channel; listViewChannels.Items.Add(item); } MessageBox.Show(String.Format("Found {0} channels", channels.Count)); buttonScan.Enabled = true; buttonTune.Enabled = true; btnEPG.Enabled = true; timer1.Enabled = true; }