예제 #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();
 }