Пример #1
0
        /// <summary>
        /// Load profiling data.
        /// </summary>
        private void Load(string path)
        {
            Initialize(path);

            var   startTime       = DateTime.Now;
            var   lastTime        = startTime;
            ulong cnt             = 0;
            var   progressMonitor = new ProgressMonitor()
            {
                Start = delegate
                {
                    ProfilerPlugin.Instance.SaveExplorerWindowCaption();
                    ProfilerPlugin.Instance.UpdateExplorerWindowProgress(0);
                },

                Stop = delegate
                {
                    ProfilerPlugin.Instance.RestoreExplorerWindowCaption();
                },

                Tick = delegate
                {
                    if (++cnt % 1000 == 0)
                    {
                        var now = DateTime.Now;
                        if ((now - lastTime).TotalSeconds >= 0.5)
                        {
                            ProfilerPlugin.Instance.UpdateExplorerWindowProgress((long)Math.Min(((now - startTime).TotalSeconds) * 5, 99));
                            lastTime = now;
                        }
                    }
                }
            };

            try
            {
                progressMonitor.Start();
                LoadData(progressMonitor);
            }
            finally
            {
                progressMonitor.Stop();
            }
        }