Beispiel #1
0
            /// <summary>
            ///     Obtain new sample from performance counters, and refresh the values saved in dlSpeed, ulSpeed, etc.
            ///     This method is supposed to be called only in NetworkMonitor, one time every second.
            /// </summary>
            internal void refresh()
            {
                _downloadValue = DownLoadCounter.NextSample().RawValue;
                _uploadValue   = UpLoadCounter.NextSample().RawValue;

                // Calculates download and upload speed.
                DownloadSpeed = _downloadValue - _downloadValueOld;
                UploadSpeed   = _uploadValue - _uploadValueOld;

                _downloadValueOld = _downloadValue;
                _uploadValueOld   = _uploadValue;
            }
Beispiel #2
0
 /// <summary>
 ///     Preparations for monitoring.
 /// </summary>
 internal void init()
 {
     // Since dlValueOld and ulValueOld are used in method refresh() to calculate network speed, they must have be initialized.
     _downloadValueOld = DownLoadCounter.NextSample().RawValue;
     _uploadValueOld   = UpLoadCounter.NextSample().RawValue;
 }