示例#1
0
        public async Task UpdateDataAsync()
        {
            var task = await Task.Run(() =>
            {
                _winFormsQueries.AddComputerUsageData();
                Thread.Sleep(1000);
                return(_winFormsQueries.GetComputerUsageData());
            });

            var usageData = task;

            var time     = usageData.Time?.ToString("mm:ss");
            var cpuUsage = usageData.CpuUsage;
            var ramUsage = usageData.RamUsage;

            CpuUsageBox.Clear();
            CpuUsageBox.AppendText(cpuUsage + " %");
            RamUsageBox.Clear();
            RamUsageBox.AppendText(ramUsage + " %");

            UsageChart.Series[0].Points.AddXY(time, cpuUsage);
            UsageChart.Series[1].Points.AddXY(time, ramUsage);

            while (UsageChart.Series[0].Points.Count > 10)
            {
                UsageChart.Series[0].Points.RemoveAt(0);
            }
            while (UsageChart.Series[1].Points.Count > 10)
            {
                UsageChart.Series[1].Points.RemoveAt(0);
            }
        }
示例#2
0
 private void ClearTextBoxes()
 {
     UserNameBox.Clear();
     ComputerNameBox.Clear();
     RamBox.Clear();
     RamUsageBox.Clear();
     CpuUsageBox.Clear();
     CpuBox.Clear();
     IpBox.Clear();
     AverageDiskQueueLengthBox.Clear();
     AvailableDiskSpaceGBBox.Clear();
     VideoCardBox.Clear();
 }
示例#3
0
 private void FillTextBoxes(ComputerSummary computerMetrics)
 {
     UserNameBox.AppendText(computerMetrics.User);
     ComputerNameBox.AppendText(computerMetrics.Name);
     RamBox.AppendText(computerMetrics.Ram + " MB");
     RamUsageBox.AppendText(computerMetrics.RamUsage + " %");
     CpuUsageBox.AppendText(computerMetrics.CpuUsage + " %");
     CpuBox.AppendText(computerMetrics.Cpu);
     IpBox.AppendText(computerMetrics.Ip.ToString());
     AverageDiskQueueLengthBox.AppendText(computerMetrics.AverageDiskQueueLength.ToString());
     AvailableDiskSpaceGBBox.AppendText(computerMetrics.AvailableDiskSpaceGb + " GB");
     VideoCardBox.AppendText(computerMetrics.VideoCard);
 }