private void _livePerformanceCommand_LiveDataReceived(object sender, LiveData e)
        {
            if (IsLiveUpdateEnabled)
            {
                _livePerformanceCommand.GetLiveData();
            }

            LiveData        = e;
            CurrentCpuSpeed = (e.ClockSpeed * 0.001).ToString("0.00") + " GHz";
            UpTime          = TimeSpan.FromSeconds(e.UpTimeSeconds).ToString(@"dd\.hh\:mm\:ss");
            Application.Current.Dispatcher.BeginInvoke(
                new Action(() =>
            {
                GraphPoints.RemoveAt(0);
                GraphPoints.Add(new GraphPoint(_time, e.InUse,
                                               (double)e.UsedMemory / StaticPerformanceData.TotalMemory * 100));
            }));
            _time = _time.AddSeconds(1);

            AvailableMemory = StaticPerformanceData.TotalMemory - e.UsedMemory;

            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                foreach (var ethernetAdapterData in e.EthernetAdapterData)
                {
                    if (_ethernetAdapterViewModels.ContainsKey(ethernetAdapterData.Name))
                    {
                        var item = _ethernetAdapterViewModels[ethernetAdapterData.Name];
                        item.NewData(ethernetAdapterData);
                    }
                }
            }));
        }
示例#2
0
 private void RemakeGraph(int line)
 {
     for (int i = 0; i < _points[line].Count - 1; i++)
     {
         var x1 = Box.X + 1 + (_xScale * i);
         var y1 = Box.Y - 1 + (_yScale * (_maxValue - _points[line][i]));
         var x2 = Box.X + 3 + (_xScale * (i + 1));
         var y2 = Box.Y - 1 + (_yScale * (_maxValue - _points[line][i + 1]));
         _graphPoints[line, i] = new GraphPoints(x1, y1, x2, y2);
     }
 }