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


C# TvBusinessLayer.AddChannelToRadioGroup方法代码示例

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


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

示例1: AddSelectedItemsToGroup

    private void AddSelectedItemsToGroup(MPListView sourceListView)
    {
      if (_channelGroup == null)
      {
        return;
      }

      TvBusinessLayer layer = new TvBusinessLayer();
      foreach (ListViewItem sourceItem in sourceListView.SelectedItems)
      {
        Channel channel = null;
        if (sourceItem.Tag is Channel)
        {
          channel = (Channel)sourceItem.Tag;
        }
        else if (sourceItem.Tag is RadioGroupMap)
        {
          channel = layer.GetChannel(((RadioGroupMap)sourceItem.Tag).IdChannel);
        }
        else
        {
          continue;
        }

        RadioGroupMap groupMap = null;

        layer.AddChannelToRadioGroup(channel, _channelGroup);

        //get the new group map and set the listitem tag
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (RadioGroupMap));

        sb.AddConstraint(Operator.Equals, "idChannel", channel.IdChannel);
        sb.AddConstraint(Operator.Equals, "idGroup", _channelGroup.IdGroup);

        SqlStatement stmt = sb.GetStatement(true);

        groupMap = ObjectFactory.GetInstance<RadioGroupMap>(stmt.Execute());

        foreach (ListViewItem item in listView1.Items)
        {
          if ((item.Tag as Channel) == channel)
          {
            item.Tag = groupMap;
            break;
          }
        }
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:48,代码来源:ChannelsInRadioGroupControl.cs

示例2: addToFavoritesToolStripMenuItem_Click

    private void addToFavoritesToolStripMenuItem_Click(object sender, EventArgs e)
    {
      RadioChannelGroup group;
      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;

      if (menuItem.Tag == null)
      {
        GroupNameForm dlg = new GroupNameForm();
        dlg.IsRadio = true;

        if (dlg.ShowDialog(this) != DialogResult.OK)
        {
          return;
        }

        group = new RadioChannelGroup(dlg.GroupName, 9999);
        group.Persist();

        UpdateMenuAndTabs();
      }
      else
      {
        group = (RadioChannelGroup)menuItem.Tag;
      }

      ListView.SelectedIndexCollection indexes = listView1.SelectedIndices;
      if (indexes.Count == 0)
        return;

      TvBusinessLayer layer = new TvBusinessLayer();

      for (int i = 0; i < indexes.Count; ++i)
      {
        ListViewItem item = listView1.Items[indexes[i]];
        RadioGroupMap map = (RadioGroupMap)item.Tag;
        Channel channel = map.ReferencedChannel();
        layer.AddChannelToRadioGroup(channel, group.GroupName);
      }
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:39,代码来源:ChannelsInRadioGroupControl.cs

示例3: DoScan


//.........这里部分代码省略.........
            {
              //add new channel
              exists = false;
              dbChannel = layer.AddNewChannel(channel.Name);
              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();
            }

            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);
              }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:67,代码来源:CardDvbC.cs

示例4: ReLoad

    public void ReLoad()
    {
      //System.Diagnostics.Debugger.Launch();
      try
      {
        SetupDatabaseConnection();
        Log.Info("get channels from database");
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
        sb.AddConstraint(Operator.Equals, "isTv", 1);
        sb.AddOrderByField(true, "sortOrder");
        SqlStatement stmt = sb.GetStatement(true);
        channels = ObjectFactory.GetCollection(typeof (Channel), stmt.Execute());
        Log.Info("found:{0} tv channels", channels.Count);
        TvNotifyManager.OnNotifiesChanged();
        m_groups.Clear();

        TvBusinessLayer layer = new TvBusinessLayer();
        RadioChannelGroup allRadioChannelsGroup =
          layer.GetRadioChannelGroupByName(TvConstants.RadioGroupNames.AllChannels);
        IList<Channel> radioChannels = layer.GetAllRadioChannels();
        if (radioChannels != null)
        {
          if (radioChannels.Count > allRadioChannelsGroup.ReferringRadioGroupMap().Count)
          {
            foreach (Channel radioChannel in radioChannels)
            {
              layer.AddChannelToRadioGroup(radioChannel, allRadioChannelsGroup);
            }
          }
        }
        Log.Info("Done.");

        Log.Info("get all groups from database");
        sb = new SqlBuilder(StatementType.Select, typeof (ChannelGroup));
        sb.AddOrderByField(true, "groupName");
        stmt = sb.GetStatement(true);
        IList<ChannelGroup> groups = ObjectFactory.GetCollection<ChannelGroup>(stmt.Execute());
        IList<GroupMap> allgroupMaps = GroupMap.ListAll();

        bool hideAllChannelsGroup = false;
        using (
          Settings xmlreader =
            new MPSettings())
        {
          hideAllChannelsGroup = xmlreader.GetValueAsBool("mytv", "hideAllChannelsGroup", false);
        }


        foreach (ChannelGroup group in groups)
        {
          if (group.GroupName == TvConstants.TvGroupNames.AllChannels)
          {
            foreach (Channel channel in channels)
            {
              if (channel.IsTv == false)
              {
                continue;
              }
              bool groupContainsChannel = false;
              foreach (GroupMap map in allgroupMaps)
              {
                if (map.IdGroup != group.IdGroup)
                {
                  continue;
                }
                if (map.IdChannel == channel.IdChannel)
                {
                  groupContainsChannel = true;
                  break;
                }
              }
              if (!groupContainsChannel)
              {
                layer.AddChannelToGroup(channel, TvConstants.TvGroupNames.AllChannels);
              }
            }
            break;
          }
        }

        groups = ChannelGroup.ListAll();
        foreach (ChannelGroup group in groups)
        {
          //group.GroupMaps.ApplySort(new GroupMap.Comparer(), false);
          if (hideAllChannelsGroup && group.GroupName.Equals(TvConstants.TvGroupNames.AllChannels) && groups.Count > 1)
          {
            continue;
          }
          m_groups.Add(group);
        }
        Log.Info("loaded {0} tv groups", m_groups.Count);

        //TVHome.Connected = true;
      }
      catch (Exception ex)
      {
        Log.Error("TVHome: Error in Reload");
        Log.Error(ex);
        //TVHome.Connected = false;
      }
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:TVHomeNavigator.cs

示例5: DoTvScan


//.........这里部分代码省略.........
            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;
        }
      }
      catch (TvExceptionSWEncoderMissing)
      {
        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);
      }
      catch (TvExceptionGraphBuildingFailed)
      {
        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);
      }
      catch (Exception ex)
      {
        Log.Error("analog: DoTvScan error ({0})", ex.StackTrace);
        MessageBox.Show(string.Format("Generic error: {0}", ex.Message), "Unable to scan", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
      }
      finally
      {
        IUser user = new User();
        user.CardId = _cardNumber;
        RemoteControl.Instance.StopCard(user);
        RemoteControl.Instance.EpgGrabberEnabled = true;
        mpButtonScanTv.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;
        checkButton.Enabled = true;
      }
      ListViewItem lastItem =
        mpListView1.Items.Add(
          new ListViewItem(String.Format("Total tv channels new:{0} updated:{1}", channelsNew, channelsUpdated)));
      lastItem.EnsureVisible();
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:CardAnalog.cs

示例6: importButton_Click


//.........这里部分代码省略.........
              // using AddChannel would incorrectly "merge" these totally different channels.
              // see this: http://forum.team-mediaportal.com/1-0-rc1-svn-builds-271/importing-exported-channel-list-groups-channels-39368/
              Log.Info("TvChannels: Adding {0}. channel: {1}", channelCount, displayName);
              IList<Channel> foundExistingChannels = layer.GetChannelsByName(displayName);
              if (mergeChannels && (foundExistingChannels != null && foundExistingChannels.Count > 0))
              {
                dbChannel = foundExistingChannels[0];
              }
              else
              {
                dbChannel = layer.AddNewChannel(displayName, chChannelNumber);
              }

              dbChannel.GrabEpg = grabEpg;
              dbChannel.IsRadio = isRadio;
              dbChannel.IsTv = isTv;
              dbChannel.LastGrabTime = lastGrabTime;
              dbChannel.SortOrder = sortOrder;
              dbChannel.TimesWatched = timesWatched;
              dbChannel.TotalTimeWatched = totalTimeWatched;
              dbChannel.VisibleInGuide = visibileInGuide;
              dbChannel.DisplayName = displayName;
              dbChannel.Persist();

              //
              // chemelli: When we import channels we need to add those to the "AllChannels" group
              //
              if (isTv)
              {
                layer.AddChannelToGroup(dbChannel, TvConstants.TvGroupNames.AllChannels);
              }
              else
              {
                layer.AddChannelToRadioGroup(dbChannel, TvConstants.RadioGroupNames.AllChannels);
              }

              foreach (XmlNode nodeMap in mappingList)
              {
                int idCard = Int32.Parse(nodeMap.Attributes["IdCard"].Value);
                XmlNode nodeCard =
                  doc.SelectSingleNode(String.Format("/tvserver/servers/server/cards/card[@IdCard={0}]", idCard));
                Card dbCard = layer.GetCardByDevicePath(nodeCard.Attributes["DevicePath"].Value);
                if (dbCard != null)
                {
                  layer.MapChannelToCard(dbCard, dbChannel, false);
                }
              }
              foreach (XmlNode nodeTune in tuningList)
              {
                int bandwidth = Int32.Parse(nodeTune.Attributes["Bandwidth"].Value);
                int channelNumber = Int32.Parse(nodeTune.Attributes["ChannelNumber"].Value);
                int channelType = Int32.Parse(nodeTune.Attributes["ChannelType"].Value);
                int countryId = Int32.Parse(nodeTune.Attributes["CountryId"].Value);
                int diseqc = Int32.Parse(nodeTune.Attributes["Diseqc"].Value);
                bool fta = (nodeTune.Attributes["FreeToAir"].Value == "True");
                int frequency = Int32.Parse(nodeTune.Attributes["Frequency"].Value);
                int majorChannel = Int32.Parse(nodeTune.Attributes["MajorChannel"].Value);
                int minorChannel = Int32.Parse(nodeTune.Attributes["MinorChannel"].Value);
                int modulation = Int32.Parse(nodeTune.Attributes["Modulation"].Value);
                string name = nodeTune.Attributes["Name"].Value;
                int networkId = Int32.Parse(nodeTune.Attributes["NetworkId"].Value);
                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);
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:67,代码来源:ImportExport.cs

示例7: btnPlaylist_Click

 private void btnPlaylist_Click(object sender, EventArgs e)
 {
   OpenFileDialog dlg = new OpenFileDialog();
   dlg.AddExtension = false;
   dlg.CheckFileExists = true;
   dlg.CheckPathExists = true;
   dlg.Filter = "playlists (*.m3u;*.pls;*.b4s;*.wpl)|*.m3u;*.pls;*.b4s;*.wpl";
   dlg.Multiselect = false;
   dlg.Title = "Select the playlist file to import";
   if (dlg.ShowDialog(this) != DialogResult.OK)
     return;
   IPlayListIO listIO = PlayListFactory.CreateIO(dlg.FileName);
   PlayList playlist = new PlayList();
   if (!listIO.Load(playlist, dlg.FileName))
   {
     MessageBox.Show("There was an error parsing the playlist file", "Error", MessageBoxButtons.OK,
                     MessageBoxIcon.Error);
     return;
   }
   TvBusinessLayer layer = new TvBusinessLayer();
   int iInserted = 0;
   foreach (PlayListItem item in playlist)
   {
     if (string.IsNullOrEmpty(item.FileName))
       continue;
     if (string.IsNullOrEmpty(item.Description))
       item.Description = item.FileName;
     Channel channel = new Channel(true, false, 0, Schedule.MinSchedule, false,
                                   Schedule.MinSchedule, 10000, true, "", item.Description);
     channel.Persist();
     layer.AddWebStreamTuningDetails(channel, item.FileName, 0);
     layer.AddChannelToRadioGroup(channel, TvConstants.RadioGroupNames.AllChannels);
     iInserted++;
   }
   MessageBox.Show("Imported " + iInserted + " new channels from playlist");
   OnSectionActivated();
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:37,代码来源:RadioChannels.cs

示例8: 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

示例9: OnAddToFavoritesMenuItem_Click

    private void OnAddToFavoritesMenuItem_Click(object sender, EventArgs e)
    {
      RadioChannelGroup group;
      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
      if (menuItem.Tag == null)
      {
        GroupNameForm dlg = new GroupNameForm();
        dlg.IsRadio = true;
        if (dlg.ShowDialog(this) != DialogResult.OK)
        {
          return;
        }
        group = new RadioChannelGroup(dlg.GroupName, 9999);
        group.Persist();

        this.RefreshContextMenu();
        this.RefreshTabs();
      }
      else
      {
        group = (RadioChannelGroup)menuItem.Tag;
      }

      ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
      if (indexes.Count == 0)
        return;
      TvBusinessLayer layer = new TvBusinessLayer();
      for (int i = 0; i < indexes.Count; ++i)
      {
        ListViewItem item = mpListView1.Items[indexes[i]];

        Channel channel = (Channel)item.Tag;
        layer.AddChannelToRadioGroup(channel, group);

        string groupString = item.SubItems[1].Text;
        if (groupString == string.Empty)
        {
          groupString = group.GroupName;
        }
        else
        {
          groupString += ", " + group.GroupName;
        }

        item.SubItems[1].Text = groupString;
      }

      mpListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:49,代码来源:RadioChannels.cs

示例10: buttonOk_Click

    private void buttonOk_Click(object sender, EventArgs e)
    {
      if (textBoxName.Text.Length == 0)
      {
        MessageBox.Show("Please enter a name for this channel");
        return;
      }
      int channelNumber;
      if (!Int32.TryParse(textBoxChannelNumber.Text, out channelNumber))
      {
        MessageBox.Show(this, "Please enter a valid channel number!", "Incorrect input");
        return;
      }
      if (channelNumber < 0)
      {
        MessageBox.Show(this, "Please enter a positive channel number!", "Incorrect input");
        return;
      }
      _channel.DisplayName = textBoxName.Text;
      _channel.ChannelNumber = channelNumber;
      _channel.VisibleInGuide = checkBoxVisibleInTvGuide.Checked;
      _channel.IsTv = _isTv;
      _channel.IsRadio = !_isTv;
      _channel.Persist();
      if (_newChannel)
      {
        TvBusinessLayer layer = new TvBusinessLayer();
        if (_isTv)
        {
          layer.AddChannelToGroup(_channel, TvConstants.TvGroupNames.AllChannels);
        }
        else
        {
          layer.AddChannelToRadioGroup(_channel, TvConstants.RadioGroupNames.AllChannels);
        }
      }
      foreach (TuningDetail detail in _tuningDetails)
      {
        detail.IdChannel = _channel.IdChannel;
        detail.IsRadio = !_isTv;
        detail.IsTv = _isTv;
        if (string.IsNullOrEmpty(detail.Name))
        {
          detail.Name = _channel.DisplayName;
        }
        detail.Persist();
      }

      foreach (TuningDetail detail in _tuningDetailsToDelete)
      {
        detail.Remove();
      }


      DialogResult = DialogResult.OK;
      Close();
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:57,代码来源:FormEditChannel.cs

示例11: DoScan


//.........这里部分代码省略.........
         ATSCChannel channel = (ATSCChannel)channels[i];
         //No support for channel moving, or merging with existing channels here.
         //We do not know how ATSC works to correctly implement this.
         TuningDetail currentDetail = layer.GetTuningDetail(channel);
         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
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:67,代码来源:CardAtsc.cs

示例12: DoScan


//.........这里部分代码省略.........
         if (currentDetail != null)
         {
           if (channel.IsDifferentTransponder(layer.GetTuningChannel(currentDetail)))
           {
             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
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:67,代码来源:CardAtsc.cs

示例13: OnAddToFavoritesMenuItem_Click

    private void OnAddToFavoritesMenuItem_Click(object sender, EventArgs e)
    {
      RadioChannelGroup group;
      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
      if (menuItem.Tag == null)
      {
        GroupNameForm dlg = new GroupNameForm();
        dlg.IsRadio = true;
        if (dlg.ShowDialog(this) != DialogResult.OK)
        {
          return;
        }
        group = new RadioChannelGroup(dlg.GroupName, 9999);
        group.Persist();

        this.RefreshContextMenu();
        this.RefreshTabs();
      }
      else
      {
        group = (RadioChannelGroup)menuItem.Tag;
      }

      ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
      if (indexes.Count == 0)
        return;
      TvBusinessLayer layer = new TvBusinessLayer();
      for (int i = 0; i < indexes.Count; ++i)
      {
        ListViewItem item = mpListView1.Items[indexes[i]];

        Channel channel = (Channel)item.Tag;
        layer.AddChannelToRadioGroup(channel, group);

        IList<string> groups = channel.GroupNames;
        List<string> groupNames = new List<string>();
        foreach (string groupName in groups)
        {
          if (groupName != TvConstants.TvGroupNames.AllChannels &&
              groupName != TvConstants.RadioGroupNames.AllChannels)
          {
            //Don't add "All Channels"
            groupNames.Add(groupName);
          }
        }
        item.SubItems[2].Text = String.Join(", ", groupNames.ToArray());
      }

      mpListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:50,代码来源:RadioChannels.cs


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