Ejemplo n.º 1
0
        private void channelScanWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            int numChannels = this.MaxChannel.PhysicalChannel - this.MinChannel.PhysicalChannel;
            IVirtualChannelProvider _virtualChannelTuner = this as IVirtualChannelProvider;

            for (int i = this.MinChannel.PhysicalChannel; i <= this.MaxChannel.PhysicalChannel; i++)
            {
                if (CheckScanCanceled(e))
                {
                    return;
                }

                this.SetChannel(new Channel(i));
                Thread.Sleep(500);

                if (CheckScanCanceled(e))
                {
                    return;
                }

                int str = this.GetSignalStrength();
                AppLogger.Message("Try channel : " + i + " str=" + str);
                if (str != 0)
                {
                    Channel actual = this.GetChannel();
                    if (actual.MajorChannel != -1)
                    {
                        if (_virtualChannelTuner != null)
                        {
                            List <Channel> virtualChannels = _virtualChannelTuner.GetVirtualChannels();
                            foreach (Channel ch in virtualChannels)
                            {
                                if ((ch.MajorChannel == actual.MajorChannel) && (ch.MinorChannel > 0))
                                {
                                    ch.CarrierFrequency = actual.CarrierFrequency;
                                    _foundChannels.Add(ch);
                                }
                            }
                        }
                        else
                        {
                            _foundChannels.Add(actual);
                        }
                    }
                }

                if (CheckScanCanceled(e))
                {
                    return;
                }
                channelScanWorker.ReportProgress((int)(((double)(i - this.MinChannel.PhysicalChannel) / (double)numChannels) * 100));
            }
        }
Ejemplo n.º 2
0
        private void AddChannel()
        {
            var channel = new ChannelInfo();

            channel.CSMSSelectedItem = CSMSCollection.First();
            ChannelCollection.Add(channel);
        }
Ejemplo n.º 3
0
        public static ChannelCollection SelectByDmIdByBid(string DM_ID, string B_ID)
        {
            ChannelCollection List = new ChannelCollection();

            SqlParameter[] obj = new SqlParameter[2];
            if (String.IsNullOrEmpty(DM_ID))
            {
                obj[0] = new SqlParameter("DM_ID", DBNull.Value);
            }
            else
            {
                obj[0] = new SqlParameter("DM_ID", DM_ID);
            }
            if (String.IsNullOrEmpty(B_ID))
            {
                obj[1] = new SqlParameter("B_ID", DBNull.Value);
            }
            else
            {
                obj[1] = new SqlParameter("B_ID", B_ID);
            }
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssChannel_Select_SelectByDmIdByBid_linhnx", obj))
            {
                while (rd.Read())
                {
                    List.Add(getFromReader(rd));
                }
            }
            return(List);
        }
        public void DoNotDuplicateChannelWhenCallingGetChannel()
        {
            var collection = new ChannelCollection();
            var channel    = new Channel("#test");

            collection.Add(channel);
            var channel2 = collection.GetChannel("#test");

            Assert.Single(collection);
            Assert.Same(channel, channel2);
        }
Ejemplo n.º 5
0
        public static ChannelCollection SelectAll()
        {
            ChannelCollection List = new ChannelCollection();

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssChannel_Select_SelectAll_linhnx"))
            {
                while (rd.Read())
                {
                    List.Add(getFromReader(rd));
                }
            }
            return(List);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            ChannelCollection cc = SessionManager.WaterUserSession.WaterUser.ChannelCollection;

            cc.Clear();
            foreach (ListItem item in this.clChannel.Items)
            {
                if (item.Selected)
                {
                    int          id = Convert.ToInt32(item.Value);
                    ChannelClass c  = ChannelFactory.CreateChannel(id);
                    cc.Add(c);
                }
            }
            Response.Redirect("WaterUser.aspx");
        }
 private void EnsureIncomingChannelCollection()
 {
     lock (ThisLock)
     {
         if (_incomingChannels == null)
         {
             _incomingChannels = new ChannelCollection(this, ThisLock);
             if (_firstIncomingChannel != null)
             {
                 _incomingChannels.Add(_firstIncomingChannel);
                 ChannelRemoved(_firstIncomingChannel); // Adding to collection called ChannelAdded, so call ChannelRemoved to balance
                 _firstIncomingChannel = null;
             }
         }
     }
 }
 private static void fixChannelReferences(ChannelCollection<IChannel> collection,
     ChannelReferencesCollection reference,
     Dictionary<string, IChannel> lookup)
 {
     for (int k = 0; k < reference.Count; k++)
     {
         if (!lookup.ContainsKey(reference[k].Name))
             throw new KeyNotFoundException(string.Format("Channel '{0}' undefined.", reference[k].Name));
         collection.Add(lookup[reference[k].Name]);
     }
 }
Ejemplo n.º 9
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            _timer.Enabled = false;
            int str = _baseTuner.GetSignalStrength();

            Debug.WriteLine("Channel " + _current.ToString() + " Str: " + str.ToString());
            if (str != 0)
            {
                Channel actual = _baseTuner.TryChannel;
                if (actual != null)
                {
                    Debug.WriteLine("actually found channel: " + actual.ToDebugString());
                    if (_virtualChannelTuner != null)
                    {
                        List <Channel> virtualChannels = _virtualChannelTuner.GetVirtualChannels();
                        foreach (Channel ch in virtualChannels)
                        {
                            _channelList.Add(ch);
                        }
                    }
                    else
                    {
                        _channelList.Add(actual);
                    }
                    _channelList.DumpToDebug();
                }
            }

            if (Current.Equals(_max))
            {
                Stop();

                _baseTuner.KnownChannels = this.FoundChannels;

                if (_baseTuner.KnownChannels.Count > 0)
                {
                    _baseTuner.Channel = _baseTuner.KnownChannels.Items[0];
                }

                if (ChannelScanComplete != null)
                {
                    ChannelScanComplete.Invoke(this, new ChannelScanCompleteEventArgs(_channelList.Count));
                }
            }
            else
            {
                Current = new Channel(Current.PhysicalChannel + 1);
                _baseTuner.TryChannel = Current;
                curChannelCount++;
                if (ChannelScanProgressUpdate != null)
                {
                    this.ChannelScanProgress = (int)(((double)curChannelCount / (double)totalChannels) * 100.0);
                    ChannelScanProgressUpdate.Invoke(this, new EventArgs());
                }

                if (!_channelScanCancelled)
                {
                    _timer.Enabled = true;
                }
            }
        }