public void Create()
        {
            int progress = 10;
            var text = "a";

            var args = new ProgressEventArgs(progress, text, true);
            Assert.AreEqual(progress, args.Progress);
            Assert.AreEqual(text, args.Description);
            Assert.IsTrue(args.HasErrors);
        }
Exemple #2
0
        private void HandleDatasetProgress(object sender, ProgressEventArgs e)
        {
            ProgressDescription = e.Description;
            Progress = e.Progress / 100.0;
            if (e.Progress <= 0)
            {
                m_ProgressTracker.StartTracking();
            }

            m_ProgressTracker.UpdateProgress(e.Progress, e.Description, e.HasErrors);

            if (e.Progress >= 100)
            {
                m_ProgressTracker.StopTracking();
            }
        }
Exemple #3
0
 private void HandleOnProgress(object sender, ProgressEventArgs e)
 {
     Progress = e.Progress / 100.0;
     Description = e.Description;
     HasErrors = e.HasErrors;
 }
        private void ProcessNewProgress(object s, ProgressEventArgs e)
        {
            var reporter = s as ITrackProgress;
            if (reporter == null)
            {
                return;
            }

            double average;
            bool hasErrors = false;
            lock (m_Lock)
            {
                if (!m_ReporterToProgressMap.ContainsKey(reporter))
                {
                    return;
                }

                m_ReporterToProgressMap[reporter] = new Tuple<int, string, bool>(e.Progress, e.Description, e.HasErrors);
                average = (from pair in m_ReporterToProgressMap
                           where pair.Value.Item1 > -1
                           select pair.Value.Item1).Average();

                hasErrors = m_ReporterToProgressMap
                    .Where(p => p.Value.Item1 > -1)
                    .Any(p => p.Value.Item3);
            }

            int progress = (int)Math.Round(average);
            progress = (progress <= 100) ? progress : 100;

            RaiseOnProgress(progress, string.Empty, hasErrors);
        }