Exemple #1
0
        private void SendProgress(ProgressStateEnum state, long current, long max, DateTime start)
        {
            int progress = (int)(((double)current / (double)max) * 100.0);

            if (m_LastProgress != progress)
            {
                TimeSpan elapsedtime = DateTime.UtcNow.Subtract(start);

                double bytesPerSec = (double)current / elapsedtime.TotalSeconds;

                if (OnProgress != null)
                {
                    OnProgress.BeginInvoke(this, new ProgressEventArgs(state, progress, elapsedtime, (float)bytesPerSec), null, null);
                }

                m_LastProgress = progress;
            }
        }