private void mpButtonTimeShift_Click(object sender, EventArgs e)
        {
            if (ServiceHelper.IsStopped)
            {
                return;
            }

            _running = !_running;

            UpdateButtonCaption();

            if (_running)
            {
                mpListViewLog.Items.Clear();
                txtDisc.Value = 0;
                _total        = 0;
                _succeeded    = 0;
                _ignored      = 0;
                _failed       = 0;
                _avg          = 0;
                _firstFail    = 0;
                UpdateCounters();

                IEnumerable <Channel> channels = new List <Channel>();
                ComboBoxExItem        idItem   = (ComboBoxExItem)comboBoxGroups.Items[comboBoxGroups.SelectedIndex];

                ChannelGroup     group = ChannelGroup.Retrieve(idItem.Id);
                IList <GroupMap> maps  = group.ReferringGroupMap();

                List <Channel> channelsO         = null;
                Thread         channelTestThread = new Thread(new ParameterizedThreadStart(delegate { ChannelTestThread(channelsO); }));
                channelTestThread.Name         = "Channel Test Thread";
                channelTestThread.IsBackground = true;
                channelTestThread.Priority     = ThreadPriority.Lowest;
                channelsO = channels as List <Channel>;
                foreach (GroupMap map in maps)
                {
                    Channel ch = map.ReferencedChannel();
                    if (ch.IsTv)
                    {
                        channelsO.Add(ch);
                    }
                }
                _usersShareChannels = chkShareChannels.Checked;
                _tunedelay          = txtTuneDelay.Value;
                _concurrentTunes    = txtConcurrentTunes.Value;
                channelTestThread.Start(channelsO);
            }
        }
Example #2
0
        protected override void OnDrawItem(DrawItemEventArgs ea)
        {
            ea.DrawBackground();
            ea.DrawFocusRectangle();

            Size      imageSize = m_imageList == null ? new Size(0, 0) : m_imageList.ImageSize;
            Rectangle bounds    = ea.Bounds;

            int    xp    = bounds.Left;
            int    yp    = bounds.Top;
            string sText = this.Text;

            if (ea.Index != -1)
            {
                object oItem = Items[ea.Index];
                if (oItem is ComboBoxExItem)
                {
                    ComboBoxExItem oItemEx = (ComboBoxExItem)oItem;
                    sText = oItemEx.Text;

                    if (oItemEx.ImageIndex != -1)
                    {
                        m_imageList.Draw(ea.Graphics, bounds.Left, bounds.Top, oItemEx.ImageIndex);
                        xp += imageSize.Width;
                        int dypText = (int)ea.Graphics.MeasureString(sText, ea.Font).Height;
                        yp += ((imageSize.Height - dypText) / 2);
                    }
                }
                else
                {
                    sText = this.Items[ea.Index].ToString();
                }
            }

            ea.Graphics.DrawString(sText, ea.Font, new SolidBrush(ea.ForeColor), xp, yp);

            base.OnDrawItem(ea);
        }
    private void comboBoxGroups_SelectedIndexChanged(object sender, EventArgs e)
    {
      ComboBoxExItem idItem = (ComboBoxExItem)comboBoxGroups.Items[comboBoxGroups.SelectedIndex];
      mpComboBoxChannels.Items.Clear();
      if (idItem.Id == -1)
      {
        SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (Channel));
        sb.AddOrderByField(true, "sortOrder");
        SqlStatement stmt = sb.GetStatement(true);
        IList<Channel> channels = ObjectFactory.GetCollection<Channel>(stmt.Execute());
        foreach (Channel ch in channels)
        {
          if (ch.IsTv == false) continue;
          bool hasFta = false;
          bool hasScrambled = false;
          IList<TuningDetail> tuningDetails = ch.ReferringTuningDetail();
          foreach (TuningDetail detail in tuningDetails)
          {
            if (detail.FreeToAir)
            {
              hasFta = true;
            }
            if (!detail.FreeToAir)
            {
              hasScrambled = true;
            }
          }

          int imageIndex;
          if (hasFta && hasScrambled)
          {
            imageIndex = 5;
          }
          else if (hasScrambled)
          {
            imageIndex = 4;
          }
          else
          {
            imageIndex = 3;
          }
          ComboBoxExItem item = new ComboBoxExItem(ch.DisplayName, imageIndex, ch.IdChannel);

          mpComboBoxChannels.Items.Add(item);
        }
      }
      else
      {
        ChannelGroup group = ChannelGroup.Retrieve(idItem.Id);
        IList<GroupMap> maps = group.ReferringGroupMap();
        foreach (GroupMap map in maps)
        {
          Channel ch = map.ReferencedChannel();
          if (ch.IsTv == false) continue;
          bool hasFta = false;
          bool hasScrambled = false;
          IList<TuningDetail> tuningDetails = ch.ReferringTuningDetail();
          foreach (TuningDetail detail in tuningDetails)
          {
            if (detail.FreeToAir)
            {
              hasFta = true;
            }
            if (!detail.FreeToAir)
            {
              hasScrambled = true;
            }
          }

          int imageIndex;
          if (hasFta && hasScrambled)
          {
            imageIndex = 5;
          }
          else if (hasScrambled)
          {
            imageIndex = 4;
          }
          else
          {
            imageIndex = 3;
          }
          ComboBoxExItem item = new ComboBoxExItem(ch.DisplayName, imageIndex, ch.IdChannel);
          mpComboBoxChannels.Items.Add(item);
        }
      }
      if (mpComboBoxChannels.Items.Count > 0)
        mpComboBoxChannels.SelectedIndex = 0;
    }
Example #4
0
        private void comboBoxGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxExItem idItem = (ComboBoxExItem)comboBoxGroups.Items[comboBoxGroups.SelectedIndex];

            mpComboBoxChannels.Items.Clear();
            if (idItem.Id == -1)
            {
                SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel));
                sb.AddOrderByField(true, "sortOrder");
                SqlStatement    stmt     = sb.GetStatement(true);
                IList <Channel> channels = ObjectFactory.GetCollection <Channel>(stmt.Execute());
                foreach (Channel ch in channels)
                {
                    if (ch.IsTv == false)
                    {
                        continue;
                    }
                    bool hasFta       = false;
                    bool hasScrambled = false;
                    IList <TuningDetail> tuningDetails = ch.ReferringTuningDetail();
                    foreach (TuningDetail detail in tuningDetails)
                    {
                        if (detail.FreeToAir)
                        {
                            hasFta = true;
                        }
                        if (!detail.FreeToAir)
                        {
                            hasScrambled = true;
                        }
                    }

                    int imageIndex;
                    if (hasFta && hasScrambled)
                    {
                        imageIndex = 5;
                    }
                    else if (hasScrambled)
                    {
                        imageIndex = 4;
                    }
                    else
                    {
                        imageIndex = 3;
                    }
                    ComboBoxExItem item = new ComboBoxExItem(ch.DisplayName, imageIndex, ch.IdChannel);

                    mpComboBoxChannels.Items.Add(item);
                }
            }
            else
            {
                ChannelGroup     group = ChannelGroup.Retrieve(idItem.Id);
                IList <GroupMap> maps  = group.ReferringGroupMap();
                foreach (GroupMap map in maps)
                {
                    Channel ch = map.ReferencedChannel();
                    if (ch.IsTv == false)
                    {
                        continue;
                    }
                    bool hasFta       = false;
                    bool hasScrambled = false;
                    IList <TuningDetail> tuningDetails = ch.ReferringTuningDetail();
                    foreach (TuningDetail detail in tuningDetails)
                    {
                        if (detail.FreeToAir)
                        {
                            hasFta = true;
                        }
                        if (!detail.FreeToAir)
                        {
                            hasScrambled = true;
                        }
                    }

                    int imageIndex;
                    if (hasFta && hasScrambled)
                    {
                        imageIndex = 5;
                    }
                    else if (hasScrambled)
                    {
                        imageIndex = 4;
                    }
                    else
                    {
                        imageIndex = 3;
                    }
                    ComboBoxExItem item = new ComboBoxExItem(ch.DisplayName, imageIndex, ch.IdChannel);
                    mpComboBoxChannels.Items.Add(item);
                }
            }
            if (mpComboBoxChannels.Items.Count > 0)
            {
                mpComboBoxChannels.SelectedIndex = 0;
            }
        }