Esempio n. 1
0
        protected void AddBufferList(RecordBufferItem tNewItem)
        {
            if (!tNewItem.Available)
            {
                return;
            }

            if (m_Ticket == Int32.MaxValue)
            {
                Refresh();
            }

            lock (((ICollection)m_BufferList).SyncRoot)
            {
                if (0 == m_BufferList.Values.Count)
                {
                    m_BufferList.Add(m_Ticket++, tNewItem);
                }
                else
                {
                    if (tNewItem.SamplingName != m_BufferList.Values[0].SamplingName)
                    {
                        m_Ticket = 0;
                        m_BufferList.Clear();
                    }

                    m_BufferList.Add(m_Ticket++, tNewItem);

                    if (m_BufferList.Count >= m_BufferCount)
                    {
                        m_BufferList.RemoveAt(0);
                    }
                }
            }
        }
Esempio n. 2
0
        protected Object[] FindBuffer(Int32 tRowIndex, String tSamplingName)
        {
            if (-1 == tRowIndex)
            {
                return(null);
            }

            if (null == tSamplingName)
            {
                tSamplingName = "Temporary";
            }
            else if ("" == tSamplingName.Trim())
            {
                tSamplingName = "Temporary";
            }

            lock (((ICollection)m_BufferList).SyncRoot)
            {
                if (0 == m_BufferList.Count)
                {
                    return(null);
                }
                if (m_BufferList.Values[0].SamplingName != tSamplingName)
                {
                    return(null);
                }

                if (null != m_tLastRow)
                {
                    if ((m_tLastRow.RowIndex == tRowIndex) && (m_tLastRow.SamplingName == tSamplingName))
                    {
                        return(m_tLastRow.Items);
                    }
                }

                foreach (RecordBufferItem tItem in m_BufferList.Values)
                {
                    if ((tItem.RowIndex == tRowIndex) && (tItem.SamplingName == tSamplingName))
                    {
                        m_tLastRow = tItem;

                        return(tItem.Items);
                    }
                }
            }

            return(null);
        }