Пример #1
0
    private void buttonTune_Click(object sender, EventArgs e)
    {
      timer1.Enabled = false;
      /*
      DVBCChannel ch = new DVBCChannel();
      ch.Frequency = 340000;
      ch.NetworkId = 500;
      ch.TransportId = 2;
      ch.ServiceId = 2010;
      ch.PmtPid = 0x7d0;
      ch.SymbolRate = 6875;
      ch.ModulationType = DirectShowLib.BDA.ModulationType.Mod64Qam;
      ch.PcrPid = 0x7da;
      _currentCard.TuneScan(ch);
      timer1.Enabled = true;
      return;*/
      try
      {
        if ((_currentCard as TvCardAnalog) != null)
        {
          FormAnalogChannel dlg = new FormAnalogChannel();
          if ((_currentCard.SubChannels.Length > 0) && (_currentCard.SubChannels[0].CurrentChannel != null))
            dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;

          dlg.ShowDialog();
          _currentCard.Tune(0, dlg.Channel);
          //_currentCard.TuneScan(dlg.Channel);
          return;
        }

        if ((_currentCard as TvCardDVBT) != null)
        {
          FormDVBTChannel dlg = new FormDVBTChannel();
          if (_currentCard.SubChannels[0].CurrentChannel != null)
            dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;

          dlg.ShowDialog();
          _currentCard.Tune(0, dlg.Channel);
          //_currentCard.TuneScan(dlg.Channel);
          return;
        }

        if ((_currentCard as TvCardDVBC) != null)
        {
          FormDVBCChannel dlg = new FormDVBCChannel();
          if (_currentCard.SubChannels[0].CurrentChannel != null)
            dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;

          dlg.ShowDialog();
          _currentCard.Tune(0, dlg.Channel);
          //_currentCard.TuneScan(dlg.Channel);
          return;
        }
        if ((_currentCard as TvCardDVBS) != null)
        {
          FormDVBSChannel dlg = new FormDVBSChannel();
          if (_currentCard.SubChannels[0].CurrentChannel != null)
            dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;

          dlg.ShowDialog();
          _currentCard.Tune(0, dlg.Channel);
          //_currentCard.TuneScan(dlg.Channel);
          return;
        }
        if ((_currentCard as TvCardDvbSS2) != null)
        {
          FormDVBSChannel dlg = new FormDVBSChannel();
          if (_currentCard.SubChannels[0].CurrentChannel != null)
            dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;

          dlg.ShowDialog();
          _currentCard.Tune(0, dlg.Channel);
          //_currentCard.TuneScan(dlg.Channel);
          return;
        }
        if ((_currentCard as TvCardATSC) != null)
        {
          FormATSCChannel dlg = new FormATSCChannel();
          if (_currentCard.SubChannels[0].CurrentChannel != null)
            dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;

          dlg.ShowDialog();
          _currentCard.Tune(0, dlg.Channel);
          //_currentCard.TuneScan(dlg.Channel);
          return;
        }
      }
      finally
      {
        timer1.Enabled = true;
      }
    }
Пример #2
0
        private void buttonTune_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;

            /*
             * DVBCChannel ch = new DVBCChannel();
             * ch.Frequency = 340000;
             * ch.NetworkId = 500;
             * ch.TransportId = 2;
             * ch.ServiceId = 2010;
             * ch.PmtPid = 0x7d0;
             * ch.SymbolRate = 6875;
             * ch.ModulationType = DirectShowLib.BDA.ModulationType.Mod64Qam;
             * ch.PcrPid = 0x7da;
             * _currentCard.TuneScan(ch);
             * timer1.Enabled = true;
             * return;*/
            try
            {
                if ((_currentCard as TvCardAnalog) != null)
                {
                    FormAnalogChannel dlg = new FormAnalogChannel();
                    if ((_currentCard.SubChannels.Length > 0) && (_currentCard.SubChannels[0].CurrentChannel != null))
                    {
                        dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;
                    }

                    dlg.ShowDialog();
                    _currentCard.Tune(0, dlg.Channel);
                    //_currentCard.TuneScan(dlg.Channel);
                    return;
                }

                if ((_currentCard as TvCardDVBT) != null)
                {
                    FormDVBTChannel dlg = new FormDVBTChannel();
                    if (_currentCard.SubChannels[0].CurrentChannel != null)
                    {
                        dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;
                    }

                    dlg.ShowDialog();
                    _currentCard.Tune(0, dlg.Channel);
                    //_currentCard.TuneScan(dlg.Channel);
                    return;
                }

                if ((_currentCard as TvCardDVBC) != null)
                {
                    FormDVBCChannel dlg = new FormDVBCChannel();
                    if (_currentCard.SubChannels[0].CurrentChannel != null)
                    {
                        dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;
                    }

                    dlg.ShowDialog();
                    _currentCard.Tune(0, dlg.Channel);
                    //_currentCard.TuneScan(dlg.Channel);
                    return;
                }
                if ((_currentCard as TvCardDVBS) != null)
                {
                    FormDVBSChannel dlg = new FormDVBSChannel();
                    if (_currentCard.SubChannels[0].CurrentChannel != null)
                    {
                        dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;
                    }

                    dlg.ShowDialog();
                    _currentCard.Tune(0, dlg.Channel);
                    //_currentCard.TuneScan(dlg.Channel);
                    return;
                }
                if ((_currentCard as TvCardDvbSS2) != null)
                {
                    FormDVBSChannel dlg = new FormDVBSChannel();
                    if (_currentCard.SubChannels[0].CurrentChannel != null)
                    {
                        dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;
                    }

                    dlg.ShowDialog();
                    _currentCard.Tune(0, dlg.Channel);
                    //_currentCard.TuneScan(dlg.Channel);
                    return;
                }
                if ((_currentCard as TvCardATSC) != null)
                {
                    FormATSCChannel dlg = new FormATSCChannel();
                    if (_currentCard.SubChannels[0].CurrentChannel != null)
                    {
                        dlg.Channel = _currentCard.SubChannels[0].CurrentChannel;
                    }

                    dlg.ShowDialog();
                    _currentCard.Tune(0, dlg.Channel);
                    //_currentCard.TuneScan(dlg.Channel);
                    return;
                }
            }
            finally
            {
                timer1.Enabled = true;
            }
        }