예제 #1
0
 public async Task DoMyThing(CancellationToken token = default(CancellationToken))
 {
     while (!token.IsCancellationRequested)
     {
         ProgressCPU.Value    = CPInfo.CPUInfo();
         ProgressMemory.Value = CPInfo.MemInfo();
         ProgressDisk.Value   = CPInfo.DiskInfo();
         try
         {
             await Task.Delay(900);
         }
         catch (TaskCanceledException)
         {
             break;
         }
     }
     while (!token.IsCancellationRequested)
     {
         this.Refresh();
         LabelUpload.Text = Internet.CheckInternetSpeed();
         LabelPing.Text   = Internet.CheckPing();
         try
         {
             await Task.Delay(TimeSpan.FromMinutes(2), token);
         }
         catch (TaskCanceledException)
         {
             break;
         }
     }
 }
예제 #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     ProgressCPU.Value    = CPInfo.CPUInfo();
     ProgressMemory.Value = CPInfo.MemInfo();
     ProgressDisk.Value   = CPInfo.DiskInfo();
     LabelUpload.Text     = Internet.CheckInternetSpeed();
     LabelPing.Text       = Internet.CheckPing();
 }