コード例 #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();
 }
コード例 #3
0
        private void Refresh(int refresh = 1000)
        {
            ListViewProcess.Items.Clear();
            Process[] allProc = Process.GetProcesses();
            foreach (Process p in allProc)
            {
                ListViewItem Processes = new ListViewItem(p.ProcessName);
                Processes.SubItems.Add(Convert.ToString(p.Id));
                Processes.SubItems.Add(Convert.ToString(CPInfo.GetProcessCPU(p.ProcessName) + "%"));
                Processes.SubItems.Add(Misc.SizeSuffix(p.VirtualMemorySize64));
                Processes.SubItems.Add("False");

                ListViewProcess.Items.Add(Processes);
            }
        }