Пример #1
0
        private void InvokeCpuDataUpdated(object sender, CounterDataEventArgs counterDataEventArgs)
        {
            EventHandler <CounterDataEventArgs> handler = CPUDataUpdated;

            if (handler != null)
            {
                handler(sender, counterDataEventArgs);
            }
        }
 /// <summary>
 /// Handler for CPU counter. Render new perfomance data to chart
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnCPUDataUpdated(object sender, CounterDataEventArgs e)
 {
     if (e.PerformanceDatas != null)
     {
         //get series for CPU
         Series series = chartControl.Series[0];
         chartControl.UIThread(() =>
                             {
                                 //series.Points.Clear();
                                 foreach (PerformanceData point in e.PerformanceDatas)
                                 {
                                     series.Points.AddXY(new DateTime(point.EventTickCount), point.CounterValue);
                                 }
                             });
     }
 }
 private void InvokeMemoryUpdated(object sender, CounterDataEventArgs counterDataEventArgs)
 {
     EventHandler<CounterDataEventArgs> handler = MemoryUpdated;
     if (handler != null) handler(sender, counterDataEventArgs);
 }