public override PriorityDestinationGroupList GetPriorityGroups()
        {
            PriorityDestinationGroupList list = new PriorityDestinationGroupList();
            IDataReader rd = null;

            try
            {
                Database db = DatabaseFactory.GetDatabase();
                rd = db.ExecQuery(_selectPriorityDest, _connection, null);
                while (rd.Read())
                {
                    PriorityDestinationGroup g = new PriorityDestinationGroup(
                        rd.GetDecimal(0), rd.GetDecimal(1));
                    list.Add(g);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("CSMessageConfiguration.GetPriorityGroups error - " + ex.Message);
            }
            finally
            {
                if (rd != null)
                {
                    rd.Close();
                }
            }

            return(list);
        }
        /// <summary>
        /// The thread procedure controlling the periodic sending process
        /// </summary>
        protected virtual void SendThreadProc()
        {
            Debug.WriteLine("MessageSender sender thread started");

            _timer.Change(_period, _period);
            while (!_stopping)
            {
                _evtWakeup.WaitOne();
                if (!_stopping)
                {
                    _evtWakeup.Reset();

//					if (Parameterization.MediaContext != null &&
//						Parameterization.MediaContext.IsMediaAvailable(MediaType.CcBase))
//					{
                    PriorityDestinationGroupList groups =
                        _msgCfg.GetPriorityGroups();
                    if (groups.Count > 0)
                    {
                        IEnumerator en = groups.GetEnumerator();
                        while (en.MoveNext())
                        {
                            PriorityDestinationGroup g =
                                (PriorityDestinationGroup)en.Current;
                            DataSet ds = _msgCfg.GetPriorityGroupMessages(g);
                            if (ds != null)
                            {
                                Debug.WriteLine(String.Format("MessageSender - issuing msgs <{0}, {1}>",
                                                              g.Destination, g.Priority));
                                FilterByMediaAvailablility(ds);
                                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                {
                                    ThreadPool.QueueUserWorkItem(new WaitCallback(SendOneThreadProc), ds);
                                }
                                else
                                {
                                    Debug.WriteLine("MessageSender - messages not tried (media unavailable?)");
                                }
                            }
                            else
                            {
                                Debug.WriteLine(String.Format("MessageSender - No messages found for <{0}, {1}>",
                                                              g.Destination, g.Priority));
                            }
                        }
                    }
//					}

                    Thread.Sleep(0);
                }
            }
            _timer.Change(Timeout.Infinite, Timeout.Infinite);

            Debug.WriteLine("MessageSender sender thread stopped");
        }