class UploadCenterClass:IUpLoadCenter,IDisposable
{
System.Timers.Timer timer;
private long curentbytes = 0;
private long curentbytes_end = 0;
private object lockobj = new object();
public UploadCenterClass()
{
timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.Elapsed += timer_Tick;
timer.Start();
}
public void StopTimer()
{
timer.Stop();
}
private void timer_Tick(object sender, ElapsedEventArgs e)
{
PrintNetSpeed();
}
public void UpdateBytesRate(long end, long start)
{
lock (lockobj)
{
curentbytes_end = start;
}
}
public void Dispose()
{
StopTimer();
}
}
interface IUpLoadCenter
{
void PrintNetSpeed();
void UpdateBytesRate(long end, long startl);
}