private void Tick() { if (_categories.Count > 0) { var timestamp = DateTime.Now; foreach (var categoryItem in _categories) { var category = _categoriesViewModel.GetCategory(categoryItem.Key); category.Read(timestamp, categoryItem.Value); } var chartItem = new ChartItemViewModel(timestamp.ToLongTimeString(), _counters.Where(t => t.Value != null).ToArray().ToDictionary(t => t.Id, t => new ChartValue(t.ScaledValue.GetValueOrDefault(), t.CurrentScale))); _syncContext.Post(o => { _chartItems[CurrentChartIndex] = chartItem; if (CurrentChartIndex + 1 < _chartItems.Count) { _chartItems[CurrentChartIndex + 1] = _emptyItem; } if (++CurrentChartIndex >= MaxChartItems) { CurrentChartIndex = 0; } }, null); } _timer.Start(); }