Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Reads a PA XML file into the record cache.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void ReadPaXmlFile(BackgroundWorker worker, PaDataSource ds)
        {
            var cache = RecordCache.Load(ds, m_project);

            if (cache == null)
            {
                return;
            }

            AddCustomFieldsFromPaXML(cache);

            // If the record cache member variable currently points to an empty cache, then
            // just set it to point to the cache into which we just read the specified PaXML
            // file. Otherwise move the records from the cache we just read into to the
            // member variable cache.
            if (m_recCache.Count == 0)
            {
                worker.ReportProgress(-1);
                m_recCache = cache;
            }
            else
            {
                while (cache.Count > 0)
                {
                    worker.ReportProgress(0);
                    m_recCache.Add(cache[0]);
                    cache.RemoveAt(0);
                }
            }
        }