当前位置: 首页>>代码示例>>C#>>正文


C# TvBusinessLayer.AddTuningDetails方法代码示例

本文整理汇总了C#中TvDatabase.TvBusinessLayer.AddTuningDetails方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.AddTuningDetails方法的具体用法?C# TvBusinessLayer.AddTuningDetails怎么用?C# TvBusinessLayer.AddTuningDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.TvBusinessLayer的用法示例。


在下文中一共展示了TvBusinessLayer.AddTuningDetails方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Importxmlfile


//.........这里部分代码省略.........
                                int band = Int32.Parse(GetNodeAttribute(nodeTune, "Band", "0"));
                                int pilot = Int32.Parse(GetNodeAttribute(nodeTune, "Pilot", "-1"));
                                int rollOff = Int32.Parse(GetNodeAttribute(nodeTune, "RollOff", "-1"));
                                string url = GetNodeAttribute(nodeTune, "Url", "");
                                int bitrate = Int32.Parse(GetNodeAttribute(nodeTune, "Bitrate", "0"));
                                bool isVCRSignal = (GetNodeAttribute(nodeChannel, "IsVCRSignal", "False") == "True");

                                switch (channelType)
                                {
                                    case 0: //AnalogChannel
                                        AnalogChannel analogChannel = new AnalogChannel();
                                        if (analogChannel == null)
                                        {
                                            textoutput("<RED>Could not create analog channel for " + name);
                                            return false;
                                        }
                                        analogChannel.ChannelNumber = channelNumber;
                                        analogChannel.Country = collection.Countries[countryId];
                                        analogChannel.Frequency = frequency;
                                        analogChannel.IsRadio = isRadio;
                                        analogChannel.IsTv = isTv;
                                        analogChannel.Name = name;
                                        analogChannel.TunerSource = (TunerInputType)tuningSource;
                                        analogChannel.VideoSource = (AnalogChannel.VideoInputType)videoSource;
            #if(MP100)
                                        //do nothing
            #elif(MP101)
                                        //do nothing
            #else //MP11BETA or SVN
                                        analogChannel.AudioSource = (AnalogChannel.AudioInputType)audioSource;
                                        analogChannel.IsVCRSignal = isVCRSignal;
            #endif

                                        layer.AddTuningDetails(dbChannel, analogChannel);
                                        if (DEBUG)
                                            Log.Info("TvChannels: Added tuning details for analog channel: {0} number: {1}", name, channelNumber);

                                        break;
                                    case 1: //ATSCChannel
                                        ATSCChannel atscChannel = new ATSCChannel();
                                        if (atscChannel == null)
                                        {
                                            textoutput("<RED>Could not create ATSC channel for " + name);
                                            return false;
                                        }
                                        atscChannel.MajorChannel = majorChannel;
                                        atscChannel.MinorChannel = minorChannel;
                                        atscChannel.PhysicalChannel = channelNumber;
                                        atscChannel.LogicalChannelNumber = channelNumber;
                                        atscChannel.FreeToAir = fta;
                                        atscChannel.Frequency = frequency;
                                        atscChannel.IsRadio = isRadio;
                                        atscChannel.IsTv = isTv;
                                        atscChannel.Name = name;
                                        atscChannel.NetworkId = networkId;
            #if (MP12)
            #else
                                        if (pcrPid > -1)
                                            atscChannel.PcrPid = pcrPid;

                                        if (audioPid > -1)
                                            atscChannel.AudioPid = audioPid;

                                        if (videoPid > -1)
                                            atscChannel.VideoPid = videoPid;
            #endif
开发者ID:huha001,项目名称:BackupSettings,代码行数:67,代码来源:BackupSettingsExportImport.cs

示例2: DoScan


//.........这里部分代码省略.........
            else
            {
              exists = true;
              dbChannel = currentDetail.ReferencedChannel();
            }

            if (dbChannel.IsTv)
            {
              layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
              if (checkBoxCreateSignalGroup.Checked)
              {
                layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.DVBC);
              }
              if (checkBoxCreateGroups.Checked)
              {
                layer.AddChannelToGroup(dbChannel, channel.Provider);
              }
            }
            if (dbChannel.IsRadio)
            {
              layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
              if (checkBoxCreateSignalGroup.Checked)
              {
                layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.DVBC);
              }
              if (checkBoxCreateGroups.Checked)
              {
                layer.AddChannelToRadioGroup(dbChannel, channel.Provider);
              }
            }

            if (currentDetail == null)
            {
              layer.AddTuningDetails(dbChannel, channel);
            }
            else
            {
              //update tuning details...
              TuningDetail td = layer.UpdateTuningDetails(dbChannel, channel, currentDetail);
              td.Persist();
            }

            if (channel.IsTv)
            {
              if (exists)
              {
                tv.updChannel++;
              }
              else
              {
                tv.newChannel++;
                tv.newChannels.Add(channel);
              }
            }
            if (channel.IsRadio)
            {
              if (exists)
              {
                radio.updChannel++;
              }
              else
              {
                radio.newChannel++;
                radio.newChannels.Add(channel);
              }
            }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:67,代码来源:CardDvbC.cs

示例3: DoTvScan


//.........这里部分代码省略.........
            item.Text = line;
            item.ForeColor = Color.Red;
            continue;
          }
          bool exists = false;
          channel = (AnalogChannel)channels[0];
          if (channel.Name == "")
            channel.Name = String.Format(channel.ChannelNumber.ToString());
          Channel dbChannel = null;
          if (checkBoxNoMerge.Checked)
          {
            dbChannel = layer.AddNewChannel(channel.Name);
          }
          else
          {
            IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channel.Name, 0);
            if (tuningDetails != null && tuningDetails.Count > 0)
            {
              dbChannel = tuningDetails[0].ReferencedChannel();
            }

            if (dbChannel != null)
            {
              exists = true;
            }
            else
            {
              dbChannel = layer.AddNewChannel(channel.Name);
            }
          }
          dbChannel.IsTv = channel.IsTv;
          dbChannel.IsRadio = channel.IsRadio;
          dbChannel.Persist();
          layer.AddTuningDetails(dbChannel, channel);
          layer.MapChannelToCard(card, dbChannel, false);

          if (dbChannel.IsTv)
          {
            layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
            if (checkBoxCreateSignalGroup.Checked)
            {
              layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.Analog);
            }
          }
          if (dbChannel.IsRadio)
          {
            layer.AddChannelToGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
            if (checkBoxCreateSignalGroup.Checked)
            {
              layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.Analog);
            }
          }

          if (exists)
          {
            line = String.Format("channel:{0} source:{1} : Channel update found - {2}", channel.ChannelNumber,
                                 mpComboBoxSource.SelectedItem, channel.Name);
            channelsUpdated++;
          }
          else
          {
            line = String.Format("channel:{0} source:{1} : New channel found - {2}", channel.ChannelNumber,
                                 mpComboBoxSource.SelectedItem, channel.Name);
            channelsNew++;
          }
          item.Text = line;
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:67,代码来源:CardAnalog.cs

示例4: importButton_Click


//.........这里部分代码省略.........
                int pmtPid = Int32.Parse(nodeTune.Attributes["PmtPid"].Value);
                int polarisation = Int32.Parse(nodeTune.Attributes["Polarisation"].Value);
                string provider = GetNodeAttribute(nodeTune, "Provider", "");
                int serviceId = Int32.Parse(nodeTune.Attributes["ServiceId"].Value);
                int switchingFrequency = Int32.Parse(nodeTune.Attributes["SwitchingFrequency"].Value);
                int symbolrate = Int32.Parse(nodeTune.Attributes["Symbolrate"].Value);
                int transportId = Int32.Parse(nodeTune.Attributes["TransportId"].Value);
                int tuningSource = Int32.Parse(GetNodeAttribute(nodeTune, "TuningSource", "0"));
                int videoSource = Int32.Parse(GetNodeAttribute(nodeTune, "VideoSource", "0"));
                int audioSource = Int32.Parse(GetNodeAttribute(nodeTune, "AudioSource", "0"));
                bool isVCRSignal = (GetNodeAttribute(nodeChannel, "IsVCRSignal", "False") == "True");
                int SatIndex = Int32.Parse(GetNodeAttribute(nodeTune, "SatIndex", "-1"));
                int InnerFecRate = Int32.Parse(GetNodeAttribute(nodeTune, "InnerFecRate", "-1"));
                int band = Int32.Parse(GetNodeAttribute(nodeTune, "Band", "0"));
                int pilot = Int32.Parse(GetNodeAttribute(nodeTune, "Pilot", "-1"));
                int rollOff = Int32.Parse(GetNodeAttribute(nodeTune, "RollOff", "-1"));
                string url = GetNodeAttribute(nodeTune, "Url", "");
                int bitrate = Int32.Parse(GetNodeAttribute(nodeTune, "Bitrate", "0"));

                switch (channelType)
                {
                  case 0: //AnalogChannel
                    AnalogChannel analogChannel = new AnalogChannel();
                    analogChannel.ChannelNumber = channelNumber;
                    analogChannel.Country = collection.Countries[countryId];
                    analogChannel.Frequency = frequency;
                    analogChannel.IsRadio = isRadio;
                    analogChannel.IsTv = isTv;
                    analogChannel.Name = name;
                    analogChannel.TunerSource = (TunerInputType)tuningSource;
                    analogChannel.AudioSource = (AnalogChannel.AudioInputType)audioSource;
                    analogChannel.VideoSource = (AnalogChannel.VideoInputType)videoSource;
                    analogChannel.IsVCRSignal = isVCRSignal;
                    layer.AddTuningDetails(dbChannel, analogChannel);
                    Log.Info("TvChannels: Added tuning details for analog channel: {0} number: {1}", name, channelNumber);
                    break;
                  case 1: //ATSCChannel
                    ATSCChannel atscChannel = new ATSCChannel();
                    atscChannel.MajorChannel = majorChannel;
                    atscChannel.MinorChannel = minorChannel;
                    atscChannel.PhysicalChannel = channelNumber;
                    atscChannel.FreeToAir = fta;
                    atscChannel.Frequency = frequency;
                    atscChannel.IsRadio = isRadio;
                    atscChannel.IsTv = isTv;
                    atscChannel.Name = name;
                    atscChannel.NetworkId = networkId;
                    atscChannel.PmtPid = pmtPid;
                    atscChannel.Provider = provider;
                    atscChannel.ServiceId = serviceId;
                    atscChannel.TransportId = transportId;
                    atscChannel.ModulationType = (ModulationType)modulation;
                    layer.AddTuningDetails(dbChannel, atscChannel);
                    Log.Info("TvChannels: Added tuning details for ATSC channel: {0} number: {1} provider: {2}", name,
                             channelNumber, provider);
                    break;
                  case 2: //DVBCChannel
                    DVBCChannel dvbcChannel = new DVBCChannel();
                    dvbcChannel.ModulationType = (ModulationType)modulation;
                    dvbcChannel.FreeToAir = fta;
                    dvbcChannel.Frequency = frequency;
                    dvbcChannel.IsRadio = isRadio;
                    dvbcChannel.IsTv = isTv;
                    dvbcChannel.Name = name;
                    dvbcChannel.NetworkId = networkId;
                    dvbcChannel.PmtPid = pmtPid;
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:67,代码来源:ImportExport.cs

示例5: mpButton1_Click

    private void mpButton1_Click(object sender, EventArgs e)
    {
      if (string.IsNullOrEmpty(_configuration.Graph.Crossbar.Name))
      {
        IUser user = new User();
        user.CardId = _cardNumber;
        AnalogChannel temp = new AnalogChannel();
        temp.TunerSource = TunerInputType.Antenna;
        temp.VideoSource = AnalogChannel.VideoInputType.Tuner;
        temp.AudioSource = AnalogChannel.AudioInputType.Tuner;
        temp.IsRadio = false;
        temp.IsTv = true;
        RemoteControl.Instance.Tune(ref user, temp, -1);
        _configuration = Configuration.readConfiguration(_cardNumber, _cardName, _devicePath);
        if (string.IsNullOrEmpty(_configuration.Graph.Crossbar.Name))
        {
          MessageBox.Show(this, "The S-Video channels could not be detected.");
          return;
        }
        ReCheckSettings();
      }

      TvBusinessLayer layer = new TvBusinessLayer();
      Dictionary<AnalogChannel.VideoInputType, int> videoPinMap = _configuration.Graph.Crossbar.VideoPinMap;
      AnalogChannel tuningDetail;
      Card card = layer.GetCardByDevicePath(RemoteControl.Instance.CardDevice(_cardNumber));
      Channel dbChannel;
      if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.VideoInput1))
      {
        string channelName = "CVBS#1 on " + card.IdCard;
        IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
        if (tuningDetails != null && tuningDetails.Count > 0)
        {
          dbChannel = tuningDetails[0].ReferencedChannel();
        }
        else
        {
          dbChannel = layer.AddNewChannel(channelName);
        }
        dbChannel.IsTv = true;
        dbChannel.Persist();
        tuningDetail = new AnalogChannel();
        tuningDetail.IsTv = true;
        tuningDetail.Name = dbChannel.DisplayName;
        tuningDetail.VideoSource = AnalogChannel.VideoInputType.VideoInput1;
        layer.AddTuningDetails(dbChannel, tuningDetail);
        layer.MapChannelToCard(card, dbChannel, false);
        layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
      }
      if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.VideoInput2))
      {
        string channelName = "CVBS#2 on " + card.IdCard;
        IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
        if (tuningDetails != null && tuningDetails.Count > 0)
        {
          dbChannel = tuningDetails[0].ReferencedChannel();
        }
        else
        {
          dbChannel = layer.AddNewChannel(channelName);
        }
        dbChannel.IsTv = true;
        dbChannel.Persist();
        tuningDetail = new AnalogChannel();
        tuningDetail.IsTv = true;
        tuningDetail.Name = dbChannel.DisplayName;
        tuningDetail.VideoSource = AnalogChannel.VideoInputType.VideoInput2;
        layer.AddTuningDetails(dbChannel, tuningDetail);
        layer.MapChannelToCard(card, dbChannel, false);
        layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
      }
      if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.VideoInput3))
      {
        string channelName = "CVBS#3 on " + card.IdCard;
        IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
        if (tuningDetails != null && tuningDetails.Count > 0)
        {
          dbChannel = tuningDetails[0].ReferencedChannel();
        }
        else
        {
          dbChannel = layer.AddNewChannel(channelName);
        }
        dbChannel.IsTv = true;
        dbChannel.Persist();
        tuningDetail = new AnalogChannel();
        tuningDetail.IsTv = true;
        tuningDetail.Name = dbChannel.DisplayName;
        tuningDetail.VideoSource = AnalogChannel.VideoInputType.VideoInput3;
        layer.AddTuningDetails(dbChannel, tuningDetail);
        layer.MapChannelToCard(card, dbChannel, false);
        layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
      }
      if (videoPinMap.ContainsKey(AnalogChannel.VideoInputType.SvhsInput1))
      {
        string channelName = "S-Video#1 on " + card.IdCard;
        IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channelName, 0);
        if (tuningDetails != null && tuningDetails.Count > 0)
        {
          dbChannel = tuningDetails[0].ReferencedChannel();
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:CardAnalog.cs

示例6: DoRadioScan


//.........这里部分代码省略.........
          channel.Frequency = freq;
          channel.IsTv = false;
          channel.IsRadio = true;
          float freqMHz = channel.Frequency;
          freqMHz /= 1000000f;
          string line = String.Format("frequence:{0} MHz ", freqMHz.ToString("f2"));
          ListViewItem item = mpListView1.Items.Add(new ListViewItem(line));
          item.EnsureVisible();
          IUser user = new User();
          user.CardId = _cardNumber;
          TvResult tuneResult = RemoteControl.Instance.Tune(ref user, channel, -1);
          if (tuneResult == TvResult.SWEncoderMissing)
          {
            Log.Error("analog: DoTvScan error (missing software encoder)");
            MessageBox.Show("Please install a supported audio/video encoder for your software analog card",
                            "Unable to scan", MessageBoxButtons.OK, MessageBoxIcon.Error);
            break;
          }
          if (tuneResult == TvResult.GraphBuildingFailed)
          {
            Log.Error("analog: DoTvScan error (missing software encoder)");
            MessageBox.Show(
              "The graph building. Mostly your card is not supported by TvServer. Please create a report in our forum",
              "Unable to scan", MessageBoxButtons.OK, MessageBoxIcon.Error);
            break;
          }
          UpdateStatus();
          Thread.Sleep(2000);
          if (SignalStrength(sensitivity) == 100)
          {
            channel.Name = String.Format("{0}", freq);
            Channel dbChannel = null;
            IList<TuningDetail> tuningDetails = layer.GetTuningDetailsByName(channel.Name, 0);
            if (tuningDetails != null && tuningDetails.Count > 0)
            {
              dbChannel = tuningDetails[0].ReferencedChannel();
            }
            if (dbChannel != null)
            {
              line = String.Format("frequence:{0} MHz : Channel update found - {1}", freqMHz.ToString("f2"),
                                   channel.Name);
              channelsUpdated++;
            }
            else
            {
              dbChannel = layer.AddNewChannel(channel.Name);
              line = String.Format("frequence:{0} MHz : New channel found - {1}", freqMHz.ToString("f2"), channel.Name);
              channelsNew++;
            }
            item.Text = line;
            dbChannel.IsTv = channel.IsTv;
            dbChannel.IsRadio = channel.IsRadio;
            dbChannel.Persist();

            layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
            if (checkBoxCreateSignalGroup.Checked)
            {
              layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.Analog);
            }

            layer.AddTuningDetails(dbChannel, channel);
            layer.MapChannelToCard(card, dbChannel, false);
            freq += 300000;
          }
          else
          {
            line = String.Format("frequence:{0} MHz : No Signal", freqMHz.ToString("f2"));
            item.Text = line;
            item.ForeColor = Color.Red;
          }
        }
      }
      catch (Exception ex)
      {
        Log.Write(ex);
      }
      finally
      {
        checkButton.Enabled = true;
        IUser user = new User();
        user.CardId = _cardNumber;
        RemoteControl.Instance.StopCard(user);
        RemoteControl.Instance.EpgGrabberEnabled = true;
        mpButtonScanRadio.Text = buttonText;
        progressBar1.Value = 100;
        mpComboBoxCountry.Enabled = true;
        mpComboBoxSource.Enabled = true;
        mpComboBoxSensitivity.Enabled = true;
        checkBoxCreateSignalGroup.Enabled = true;
        checkBoxNoMerge.Enabled = true;
        mpButtonScanTv.Enabled = true;
        mpButtonScanRadio.Enabled = true;
        mpButtonAddSvideoChannels.Enabled = true;
        _isScanning = false;
      }
      ListViewItem lastItem =
        mpListView1.Items.Add(
          new ListViewItem(String.Format("Total radio channels new:{0} updated:{1}", channelsNew, channelsUpdated)));
      lastItem.EnsureVisible();
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:CardAnalog.cs

示例7: DoScan


//.........这里部分代码省略.........
            else
            {
              currentDetail = layer.GetTuningDetail(channel.Url, TvBusinessLayer.GetChannelType(channel));
            }

            if (currentDetail == null)
            {
              //add new channel
              exists = false;
              dbChannel = layer.AddNewChannel(channel.Name, channel.LogicalChannelNumber);
              dbChannel.SortOrder = 10000;
              if (channel.LogicalChannelNumber >= 1)
              {
                dbChannel.SortOrder = channel.LogicalChannelNumber;
              }
              dbChannel.IsTv = channel.IsTv;
              dbChannel.IsRadio = channel.IsRadio;
              dbChannel.Persist();
            }
            else
            {
              exists = true;
              dbChannel = currentDetail.ReferencedChannel();
            }

            layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);

            if (checkBoxCreateGroups.Checked)
            {
              layer.AddChannelToGroup(dbChannel, channel.Provider);
            }
            if (currentDetail == null)
            {
              layer.AddTuningDetails(dbChannel, channel);
            }
            else
            {
              //update tuning details...
              TuningDetail td = layer.UpdateTuningDetails(dbChannel, channel, currentDetail);
              td.Persist();
            }

            if (channel.IsTv)
            {
              if (exists)
              {
                tvChannelsUpdated++;
                updatedChannels++;
              }
              else
              {
                tvChannelsNew++;
                newChannels++;
              }
            }
            if (channel.IsRadio)
            {
              if (exists)
              {
                radioChannelsUpdated++;
                updatedChannels++;
              }
              else
              {
                radioChannelsNew++;
                newChannels++;
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:67,代码来源:CardDvbIP.cs

示例8: DoScan


//.........这里部分代码省略.........
         if (currentDetail != null)
           if (channel.Frequency != currentDetail.Frequency)
             currentDetail = null;
         bool exists;
         if (currentDetail == null)
         {
           //add new channel
           exists = false;
           dbChannel = layer.AddNewChannel(channel.Name);
           dbChannel.SortOrder = 10000;
           if (channel.LogicalChannelNumber >= 1)
           {
             dbChannel.SortOrder = channel.LogicalChannelNumber;
           }
         }
         else
         {
           exists = true;
           dbChannel = currentDetail.ReferencedChannel();
         }
         dbChannel.IsTv = channel.IsTv;
         dbChannel.IsRadio = channel.IsRadio;
         dbChannel.Persist();
         if (dbChannel.IsTv)
         {
           layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
         }
         if (dbChannel.IsRadio)
         {
           layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
         }
         if (currentDetail == null)
         {
           layer.AddTuningDetails(dbChannel, channel);
         }
         else
         {
           //update tuning details...
           TuningDetail td = layer.UpdateTuningDetails(dbChannel, channel, currentDetail);
           td.Persist();
         }
         if (channel.IsTv)
         {
           if (exists)
           {
             tvChannelsUpdated++;
             updatedChannels++;
           }
           else
           {
             tvChannelsNew++;
             newChannels++;
           }
         }
         if (channel.IsRadio)
         {
           if (exists)
           {
             radioChannelsUpdated++;
             updatedChannels++;
           }
           else
           {
             radioChannelsNew++;
             newChannels++;
           }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:67,代码来源:CardAtsc.cs

示例9: DoScan


//.........这里部分代码省略.........
           {
             currentDetail = null;
           }
         }
         bool exists;
         if (currentDetail == null)
         {
           //add new channel
           exists = false;
           dbChannel = layer.AddNewChannel(channel.Name, channel.LogicalChannelNumber);
           dbChannel.SortOrder = 10000;
           if (channel.LogicalChannelNumber >= 1)
           {
             dbChannel.SortOrder = channel.LogicalChannelNumber;
           }
         }
         else
         {
           exists = true;
           dbChannel = currentDetail.ReferencedChannel();
         }
         dbChannel.IsTv = channel.IsTv;
         dbChannel.IsRadio = channel.IsRadio;
         dbChannel.Persist();
         if (dbChannel.IsTv)
         {
           layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
         }
         if (dbChannel.IsRadio)
         {
           layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
         }
         if (currentDetail == null)
         {
           layer.AddTuningDetails(dbChannel, channel);
         }
         else
         {
           //update tuning details...
           TuningDetail td = layer.UpdateTuningDetails(dbChannel, channel, currentDetail);
           td.Persist();
         }
         if (channel.IsTv)
         {
           if (exists)
           {
             tvChannelsUpdated++;
             updatedChannels++;
           }
           else
           {
             tvChannelsNew++;
             newChannels++;
           }
         }
         if (channel.IsRadio)
         {
           if (exists)
           {
             radioChannelsUpdated++;
             updatedChannels++;
           }
           else
           {
             radioChannelsNew++;
             newChannels++;
           }
         }
         layer.MapChannelToCard(card, dbChannel, false);
       }
       line += string.Format("new = {0}, updated = {1}", newChannels, updatedChannels);
       item.Text = line;
       Log.Info("ATSC: scan result, new = {0}, updated = {1}", newChannels, updatedChannels);
     }
   }
   catch (Exception ex)
   {
     Log.Write(ex);
   }
   finally
   {
     IUser user = new User();
     user.CardId = _cardNumber;
     RemoteControl.Instance.StopCard(user);
     RemoteControl.Instance.EpgGrabberEnabled = true;
     progressBar1.Value = 100;
     mpComboBoxTuningMode.Enabled = true;
     UpdateQamFrequencyFieldAvailability();
     mpButtonScanTv.Text = buttonText;
     _isScanning = false;
   }
   listViewStatus.Items.Add(
     new ListViewItem(String.Format("Total radio channels, new = {0}, updated = {1}", radioChannelsNew,
                                    radioChannelsUpdated)));
   listViewStatus.Items.Add(
     new ListViewItem(String.Format("Total TV channels, new = {0} updated = {1}", tvChannelsNew, tvChannelsUpdated)));
   ListViewItem lastItem = listViewStatus.Items.Add(new ListViewItem("Scan done!"));
   lastItem.EnsureVisible();
   Log.Info("ATSC: scan summary, new TV = {0}, updated TV = {1}, new radio = {2}, updated radio = {3}", tvChannelsNew, tvChannelsUpdated, radioChannelsNew, radioChannelsUpdated);
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:101,代码来源:CardAtsc.cs


注:本文中的TvDatabase.TvBusinessLayer.AddTuningDetails方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。