Ejemplo n.º 1
0
        private void LoaderForm_Shown(object sender, System.EventArgs e)
        {
            lblProgressMessage.Text = string.Empty;
            Application.DoEvents();             // Make sure controls render before we do something.

            var cacheFiles  = RootEntry.GetCacheFileList(_cdeList);
            var totalFiles  = cacheFiles.Count();
            var fileCounter = 0;

            barLoading.Step    = totalFiles;
            barLoading.Maximum = totalFiles;

            // Not doing a background worker.
            _rootEntries = cacheFiles.Select(s =>
            {
                _timeIt.Start(s);
                var re = RootEntry.LoadDirCache(s);
                _timeIt.Stop();
                ++fileCounter;
                lblProgressMessage.Text = $"Loading catalog {fileCounter} of {totalFiles}";
                barLoading.Value        = fileCounter;
                Application.DoEvents();                 // Get label to update.
                return(re);
            }).ToList();

            Close();
        }
Ejemplo n.º 2
0
        public void LoadData(Func <int, bool> notifyCount)
        {
            var paths          = new[] { _basePath };
            var cacheFiles     = RootEntry.GetCacheFileList(paths);
            var cacheFileCount = cacheFiles.Count;

            _loadMetric.Start("Loading catalogs");
            _notifyCount(cacheFileCount);
            _rootEntries = cacheFiles.Select(s =>
            {
                var re = RootEntry.LoadDirCache(s);
                --cacheFileCount;
                _notifyCount(cacheFileCount);
                return(re);
            }).ToList();
            _loadMetric.Stop();
        }